views:

90

answers:

2

To clearify: I use the POCO generator so that the entities are not tightly bound to the EF implementation.

In my entities, I tend to add comments for the properties but as I update the model and save it, all the comments are removed.

How can I prevent this behavior?

A: 

You could edit the T4 template to add the comments automatically?

Doobi
I don't want to create or update T4 templates for all projects. There's got to be a better way!
Adam Asham
+2  A: 

Where exactly are you entering your comments? The should go inside the entity XML files not directly into auto-generated code files. If you are using VS2010 you can edit the model EDMX and supply comments on the property page in the subsection "Documentation". Just highlight each appropriate member from your entities. You could also do it by hand editing the CSDL file. See CSDL Spec for the details. Below a sample:

    <EntityType Name="Address">
      <Key>
        <PropertyRef Name="AddressID" />
      </Key>
      <Property Type="Int32" Name="AddressID" Nullable="false" a:StoreGeneratedPattern="Identity" xmlns:a="http://schemas.microsoft.com/ado/2009/02/edm/annotation" />
      <Property Type="String" Name="AddressL1" />
      <Property Type="String" Name="AddressL2" />
      <Property Type="String" Name="City" />
      <Property Type="String" Name="Country" />
      <Property Type="String" Name="Description" />
      <Property Type="String" Name="PostalCode" />
      <Property Type="String" Name="Region" >
        <Documentation>
          <Summary>my summary</Summary>
          <LongDescription>my long description</LongDescription>
        </Documentation>
      </Property>
    </EntityType>
dcompiled