O'Reilly logo

Applied ASP.NET 4 in Context by Adam Freeman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Performing Other Data Operations

Now that we have consolidated the code that accesses the data model, we can add pages to our web application to handle other data operations. In the following sections, you will learn how to create, modify, and delete data from the database using the Entity Framework.

Adding Data

Adding new data using the entity data model is a four-step process:

  • Create a new instance of the entity class that represents rows of the table of interest.
  • Set values for the parameters of the entity object we created.
  • Add the object to the collection of similar objects maintained by the entity context.
  • Call the SaveChanges method to write the change to the database.

Because we have consolidated our data-access code, these four steps ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required