3 out of 3 rated this helpful - Rate this topic

Code First Fluent API

[This page is specific to the latest version of the Entity Framework. The latest version is available as the as the 'Entity Framework'NuGet package. For more information, see Entity Framework Releases and Versioning.]

Code First is a new development methodology available beginning with the Entity Framework 4.1. When using Code First development you usually begin by writing .NET Framework classes that define your conceptual (domain) model. The classes do not need to derive from any base classes or implement any interfaces.

After your classes are defined you can optionally specify additional mapping configuration that will override the default Code First conventions. A mapping configuration can be used to map to an existing database schema or to affect the shape of a generated schema. You can override conventions using Code First Data Annotations or the fluent API. The fluent API overrides data annotation.

The fluent API is exposed through the DbModelBuilder type and is most commonly accessed by overriding the OnModelCreating method on DbContext. The topics in this section demonstrate how to use the fluent API to configure your model.

In This Section




Build Date:

2012-05-28
Did you find this helpful?
(1500 characters remaining)