The tools for Entity Framework are trailing way behind the Entiy Framework itself. I have been running into a lot of problems lately with changes I make to Table are not reflected in my Entity Model. It is a real pain to have to recreate the entire model every time. So here is what I figured out to fix it. I’ll give a step by step guide.
PreReqs:
You have an existing mode.
You have added a column to your Table.
Open the model viewer (GUI).
Right click on open space and select Model Browser. That will bring up the model browser on the right side.
In the MB select you model, right click and select ‘Update Model from Database’.
NOTE: The act of updating from SQL will make <!– SSDL content –>(model.ssdl) of your model correct and up to date. The <!– C-S mapping content –>(model.msl) and <!– CSDL content –>(model.csdl) are still broken.
To fix the other two, in “Solution Explorer” right click on you model (.edmx) and select “Open With”. Select “XML Edior”.
In the top section <!– CSDL content –> locate your table and add your column. For me it was WorkspaceNavigationType.
<EntityType Name=”WorkspaceNavigationType”>
<Key>
<PropertyRef Name=”NavigationTypeID” />
</Key>
<Property Name=”NavigationTypeID” Type=”Int32″ Nullable=”false” />
<Property Name=”Title” Type=”String” Nullable=”false” MaxLength=”50″ Unicode=”false” />
<Property Name=”PeterColumn” Type=”Int32″ Nullable=”false” />
<Property Name=”Lous” Type=”Int32″ Nullable=”false” />
<Property Name=”MyColumn” Type=”Int32″ Nullable=”false” />
<Property Name=”Description” Type=”String” MaxLength=”50″ Unicode=”false” />
<NavigationProperty Name=”WorkspaceNavigationTrees” Relationship=”HCMS.DataAccessLayer.Models.WorkspaceNavigation.FK_WorkspaceNavigationTrees_WorkspaceNavigationType” FromRole=”WorkspaceNavigationType” ToRole=”WorkspaceNavigationTrees” />
</EntityType>
Go down to the bottom of the XML and located the <!– CSDL content –> tag and located your table in there.
<EntitySetMapping Name=”WorkspaceNavigationType”>
<EntityTypeMapping TypeName=”IsTypeOf(HCMS.DataAccessLayer.Models.WorkspaceNavigation.WorkspaceNavigationType)”>
<MappingFragment StoreEntitySet=”WorkspaceNavigationType”>
<ScalarProperty Name=”NavigationTypeID” ColumnName=”NavigationTypeID” />
<ScalarProperty Name=”Title” ColumnName=”Title” />
<ScalarProperty Name=”Description” ColumnName=”Description” />
<ScalarProperty Name=”PeterColumn” ColumnName=”PeterColumn” />
<ScalarProperty Name=”Lous” ColumnName=”Lous” />
<ScalarProperty Name=”MyColumn” ColumnName=”MyColumn” />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
Save the XML, and compile Your done. If you open your model browser, you will see your new column (or changed).


