empty .Designer.cs file after generating .edmx using EF 4.x on ASP.Net MVC4 application

asp.net-mvc-4 ef-database-first entity-framework


I have started a very simple ASP.Net MVC4 applictaion with a Database first approach (with existing DB). I have generated .edmx using ADO.Net Entity Data Model template. The process has created a xxxxxxx.Designer.cs file under xxxxxxx.edmx option. However, the .cs file is empty with the following message.

// Default code generation is disabled for model 'C:\Visual Studio 2010\Projects\xxx\DProject\Models\BIReportDataModel.edmx'. 
// To enable default code generation, change the value of the 'Code Generation Strategy' designer
// property to an alternate value. This property is available in the Properties Window when the model is
// open in the designer.

Following the message I have changed the properties which generated code in the xxxxxxx.Designer.cs file.


  1. Is this the correct thing to do? What is the purpose of this file?
  2. Do I also need to generate Strongly-typed DBContext classes from the .edmx designer page by right clicking "add code generation item" and then selecting EF DBContext Generator?

What exactly is the process for Database first approach?

I have seen lots of post/blogs/tutorials and all seems to be very confusing and mostly for CodeFirst approach.

11/19/2013 2:57:27 PM

Popular Answer

Code First is technically BOTH a Database first and NOT having a database (it is flexible) You simply create POCO's ( plain old C# objects) These classes will map out your database table schema structure how you want, whether the database exist or not. If you don't know what you are doing then you probably don't want to do this.

EDMX, previously was that the designer would get populated, but in VS 2012 and greater tt files are the default. You should use a tt editor from nuget to really get much out of them.

OR I suggest you do the following

 1. Open the EDMX file - double click
 2. Right Click in the EDMX diagram and click on Properties 
 3. In the properties window change the "Code Generation Strategy" from  None to Default
 4. Delte the tt files as you don't want both entities / contexts in project.
5/9/2019 10:16:57 PM

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