Model-First

If we’re not familiar with the Visual Studio IDE design tools such as the XML-based DataSet Schema (XSD) and the Entity Designer Model XML visual interface (EDMX), the Model-First approach can be rather confusing. The key to understanding it is to acknowledge the fact that the word Model here is meant to define a visual diagram built with the design tools. That diagram will then be used by the Framework to autogenerate the Database SQL script and the Data Model source code files.

To summarize, we can say that going Model-First will mean "working on a visual EDMX diagram and letting Entity Framework create/update the rest accordingly":

Such an approach has the following benefits:

  • We will be able to create the Database schema and the class diagram as a whole using a visual design tool, which can be great when the data structure is quite big
  • Whenever the Database changes, the model can be updated accordingly without data loss

Yet there are some downsides, as follows:

  • The diagram-driven, autogenerated SQL scripts can lead to data loss in case of updates. An easy workaround for that will be generating the scripts on disk and manually modifying them, which will require decent SQL knowledge.
  • Dealing with the diagram can be tricky, especially if we want to have precise control over our Model classes; we won’t always be able to get what we want, as the actual source code will be autogenerated by a tool.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.83.151