Using DB Migration
DB migration in Entity Framework helps you create a database or update a database schema during the application's development phase. We now have the required model and database context in place. We need to create the database now. Let's create the database in SQL Server Compact using the feature called database migration in Entity Framework. Follow these steps to do so:
- First, add the following XML tags to the
csproj
file by editing it:
<ItemGroup> <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" /> </ItemGroup>
- Open Command Prompt and navigate to the project folder.
- Execute the following command to initialize the database for migration:

Execute the command to add migration
This command creates the Migration
folder under the My
Todo
project and adds two classes to create tables and update the schema.

Files related to database migration
- Execute the following command to update the database...