title: How to efficiently set default entity values in Entity Framework 6, Database First
body: <p>I am new to Entity Framework and have only worked with database first development so far.  I have been reading Entity Framework 2E which focuses on EF4.  The generated classes in EF4 had no parameterless constructor so I was able to define partial classes and initialize entity properties in the parameterless constructors I defined there.  The other options were to edit the EDMX directly and set the StoreGeneratedPattern attribute of a property to Computed or set the Default Value attribute of the property.  The problem with the latter 2 options is that they'd be wiped out whenever I'd Update From Model. The parameterless constructors in partial classes worked nicely and were never wiped out.</p>
  
  <p>Now in EF6, the partial classes look like POCOs and are not tightly coupled to EntityObject.  However, they define parameterless constructors.  Is there a way to set default values or initialize object properties on creation that won't get wiped out when I update the model? </p>
  
  <p>I know I can resort to event handlers like Inserting on a data source, but I'd like to just set it globally.</p>
  
  <p>Thanks</p>