Code First allows you to define your model using C# or VB. Additional configuration can optionally be performed using attributes on your classes and properties or by using a fluent API.
You can connect to this database using Server Explorer in Visual Studio Db Context worked out what classes to include in the model by looking at the Db Set properties that we defined.
It then uses the default set of Code First conventions to determine table and column names, determine data types, find primary keys, etc.
If you are part of a team of developers that use source control you should either use purely automatic migrations or purely code-based migrations.
Given the limitations of automatic migrations we recommend using code-based migrations in team environments.
Most model configuration can be done using simple data annotations.
The fluent API is a more advanced way of specifying model configuration that covers everything that data annotations can do in addition to some more advanced configuration not possible with data annotations.Let’s say we wanted to rename the column that User. In this walkthrough we looked at Code First development using a new database.We defined a model using classes then used that model to create a database and store and retrieve data.Once the database was created we used Code First Migrations to change the schema as our model evolved.We also saw how to configure a model using Data Annotations and the Fluent API.Not all changes can be applied automatically - for example column renames require the use of a code-based migration.