Moving from Entity Framework 4.x to Entity Framework 6.x

Here are some remarks from the transfer:

A. If you have manually changed the model – you will probably loose all your changes. next time document any change you manually do in the model.
B. Although I saw some articles that tell you to update the edmx from the designer, once you install the EF 6.0 the new designer can’t read the old EDMX file (fault Microsoft), I just re-created it from the DB. If you have many changes, and you don’t want to recreate it from the DB – you need to consult with someone smarter than me…
C. The model namespace will replace your old namespace for the Db-context object. if you don’t want to change all the occurrence in your code, choose the same one (I had chosen the same but added 6 at the end and used search and replace to fix them).
D. Code changes:

– context.ObjectStateManager.ChangeObjectState(mySol, System.Data.EntityState.Modified) –>
context.Entry(mySol).State = System.Data.Entity.EntityState.Modified;

context.Soldier.AddObject(sol) –>context.Soldier.Add(sol);

– Create Function are not available any more (maybe they were replaced, I kind of liked them). if you used the constractor to init variables, see what they were and enter them in the next line of code.
– Stored procedures are mapped to their Database names.

Post a Comment

Your email is kept private. Required fields are marked *