O'Reilly logo

Fluent Entity Framework by Rebecca M. Riordan

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

The rules

The way Entity Framework generates a database schema can seem like magic, but in fact there are rules. Absent guidance in the form of data annotations or the Fluent API (both of which we’ll discuss later in this chapter), it will use the following conventions:

Tables

• Any class that is represented in the context by a DbSet<T> will become a table.

• Any class that is referenced by a class represented as a DbSet<T> will become a table.

• Entity Framework will pluralize the class names using its pluralization service.

• A property named “Id” or “<ClassName>Id” will be inferred as the primary key.

Fields

• The properties of a class will become fields in the corresponding table.

• If the primary key property is an integer, it will be a ...

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