Click here to Skip to main content
15,173,031 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have solution in Visual Studio 2010 and Entity Framework 4. Problem is old but still none of the answers I have found really worked for me.
Solution have metadata classes that extends models in database and existing edmx with 3 standard files for EF 4 (csdl,msl,ssdl).
When I do the "Update Model from database" option, classes, db sets are created just fine but in runtime it breaks and throws an error that entity I was modify or create in database is not part of the current context.
Problem is that metadata files are not refreshed so they have proper mappings that reflects the database changes.
Running custom tool, transform T4 templates and generating classes using Code Generation option failed for me.
So please can someone show me the exact steps that are needed to simply add or modify database, refresh changes and use modifications without having to write manually mappings in XML :)


What I have tried:

- Refreshing model from database
- Generating code for db context
- Running custom tools for templates
- Transforming T4 options
Updated 11-Aug-17 0:36am

1 solution

Upgrade entity framework, i remember that version, it is a world of pain in that sense, just upgrade through nuget in visual studio.

Or the fix that usually worked, delete all files about the edmx and then make add a new one. Especially tedious i know, as that version isn't very good at adding custom procedures unless you do it through rightclicking on design interface, but still. Safest bet, but upgrade it man, the newer ones work a lot better, and faster for that matter

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900