Understanding the code-first, model-first, and database-first approaches to domain design
There are three approaches to developing data-driven applications using Entity Framework. These are:
Code-first: In this approach, you would create your POCO classes first and then generate the database using these POCO classes
Model-first: In this approach, you would create your model first using the ADO.NET Entity Data Model Designer and then generate your database from this model
Database-first: In this approach, you would create your database first and then generate your model using the ADO.NET Entity Data Model Designer from this database
Using the code-first approach
In this approach, you would create your POCO classes first and then generate the database using these classes. Let's create a POCO class as shown:
public class Customer { public int CustomerID { get; set; } public string FirstName { get; set; } public string LastName { get; set; } }
The context class should...