How do I make the ADO.NET Entity Framework regenerate code?

entity-framework wcf-data-services


I've run into a snag with a ADO.NET Entity Framework model and a ADO.NET Data Service that is making it available. The model and data service are compiling without any problems or warnings when they come out of source control. However when I run the service I get the following error: Request Error - The server encountered an error processing the request.  See server logs for more details.

Unfortunately there are no server logs (that I am aware of) since this is VS 2008 web dev server and there really isn't any code to debug..... Through some trial and error it would appear that the generated code (model.Designer.cs) is out of date in some manner. If I perform some trivial update to the EDM that forces it to regenerate the code file, when I rerun the service it works just fine.

I've tried to delete the model.designer.cs file in the hopes that during the build the project/entity builder would detect the missing file and regenerate it for me. That didn't happen..... Does anyone know how to force this code to be regenerated? (It would also make me a bit happier about not having to keep generated code under source control.)


2/26/2019 8:00:15 PM

Accepted Answer

Right click on the EDMX file and select Run Custom Tool.

There is also a command line code generation tool called edmgen (available from a VS Command Prompt).

1/26/2009 4:23:25 AM

Popular Answer

In Visual Studio 2017, it looks like just saving the .tt file automatically re-runs the template, updating the entity class files.

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow