Entity Framework Step By Step 3 – Model First
As I have discussed in my previous post we know how to create a Database using Entity Framework Model First framework. In this post we’ll see how to read & write data using EF. When you create the Database using the designer, entity classes which we can use to access the data will be automatically generated in your solution. Please see the highlighted classes in the screen shot below. BloggingModel.Context.cs :- Represents a combination of the Unit-Of-Work and Repository patterns and enables you to query a database and group together changes that will then be written back to the store as a unit. Blog.cs & Post.cs :- Entity classes with properties defined in the database table. Writing Data static void WriteData() { using (var db = new BloggingContext()) { ...