Search code examples
asp.net-mvcentity-framework-4

Entity Framework, Updating


I'm having a great deal of trouble with the Entity Framework (4.0) due to the pattern of 'adding' to a program. (Using ASP.NET MVC)

The problem is that it feels like the entire structure of the Entity Framework is designed to 'build everything all at once'. It doesn't seem to lend itself to progressive development, because of all of the changes that go through with the tools. I.E if I go change my database, then it fubars up the models - and trying to do updates causes all kinds of havoc and chaos. This wouldn't be bad if all I had to do was re-drag everything and my models worked verbatim, but I have to make manual edits to fine tune things ...and it is getting repetitive, and error-prone.

Does anyone know of any better tools or methods for this kind of problem?


Solution

  • Ok, take two. It sounds like instead of using the designer you would be better off going the code-first route and making use of data annotations.

    Data Annotations: Link -- Check out the storeNameAttribute for the specific case you mentioned in the comment to my deleted answer

    Good code-first writeup here: http://weblogs.asp.net/scottgu/archive/2010/07/16/code-first-development-with-entity-framework-4.aspx

    I'm just starting to dig into this myself but I've got some small samples up and running so if you have specific questions let me know and I'll try to answer.