How to re-add database objects into EDMX

When you working on ADO.NET Entity Framework in VS2008, may be there are some things wrong or other else you'll need to re-add database objects into your EDMX. 

You can try the following steps:
1. Delete the Entity from the EDMX Designer's Diagram. Because that is the only way to delete an Entity from EDMX, I don't know why not MS add this function into Model Browser in VS2008.
2. Now, you can see the Entity that had been deleted exists in Model.Store yet. So, you cannot re-add it via 'Update from Database...' .
3. Open EDMX through XML Editor (Right-Click EDMX item in Solution Explorer>Open With...>XML Editor), find the Entity in <edmx:StorageModels> sections, then delete it.

Now, you can re-add database objects into your EDMX.

No comments: