O'Reilly logo

Code-First Development with Entity Framework by Sergey Barskiy

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

Chapter 2: Your First Entity Framework Application

Q1. DbSet<T> is the class you should be using to define a property in your context class that corresponds to a table in your database. The type parameter T represents a class that defines that table's structure in terms of .NET.

Q2. As DbContext holds an underlying connection to the database, you should utilize the IDisposable pattern and call Dispose on your context when you are done using it. You can also use the Using keyword to achieve the same.

Q3. The Find method can be used to locate a row in the database. It takes one or more parameters corresponding to the values of the primary key. If you have a single column that defines the primary key, only one value is needed. Multiple parameter values ...

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