Chapter 8 - Working with Databases Using Entity Framework Core

  1. Which .NET data provider would you use to work with Microsoft SQL Server 2012 Express Edition?
    • .NET Core Data Provider for SQL Server.
  2. When defining a DbContext class, what type would you use for the property that represents a table, for example, the Products property?
    • DbSet<T>, where T is the entity type, for example, Product.
    • For a Products property on another entity, for example, Category, that represents a one-to-many relationship between entities, use ICollection<T>, where T is the related entity type.
  3. What is the EF convention for primary keys?
    • The property named ID or ClassNameID is assumed to be the primary key. If the type of that property is any of the following, then the property ...

Get C# 7 and .NET Core: Modern Cross-Platform Development - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.