Entity Framework - Code First


The Entity Framework supports three different approaches to create an entity model.

    1. Code First
    2. Database First
    3. Model First

Code First

In the Code First approach, visual model designer (EDMX) is avoided completely. Engineer has to write POCO classes first and then create database from these POCO classes.

Code First modeling workflow targets a database that doesn’t exist and Code First approach will create it. Empty database can also be used and then Code First approach will add new tables to it. Code First approach allows to define model using C# or VB.Net classes. Additional configuration can be performed using fluent API or by using attributes on classes and properties.

Engineers who follow the Domain-Driven Design (DDD) principles, prefer to begin by coding domain classes first and then generating the database required to persist data.

Entity Framework - Code First

Praesent mattis

Pellentesque viverra vulputate enim. Aliquam erat volutpat. Pellentesque tristique ante ut risus. Quisque dictum. Integer nisl risus, sagittis convallis, rutrum id, elementum congue, nibh. Suspendisse dictum porta lectus. Donec placerat odio vel elit.

Read More