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.
Question:
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.
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.