EntityFramework Core Migrations | ASP.NET CORE | CLI Migrations | Package Manager Console Migratio

ASP.NET MVC
1 Apr 202007:58

Summary

TLDRThis tutorial video guides viewers through the process of performing migrations in Entity Framework using .NET. It starts by instructing how to download and install the .NET EF global tool, version 3.1.3, via CLI. The host then demonstrates opening the command prompt, utilizing the 'dotnet ef' command to add and manage migrations, and ensuring the syntax is correct. The video covers creating a migration with a specified name and updating the database with the 'update-database' command. It also addresses how to rectify common errors like spelling mistakes and concludes with verifying the migration's success in SQL Server. Additionally, the video briefly touches on using the Package Manager Console for migrations, providing an alternative to CLI.

Takeaways

  • πŸ˜€ The video is a tutorial on how to perform migration in Entity Framework using .NET.
  • πŸ”§ First step is to download the .NET EF tool globally using the CLI command 'dotnet tool install --global dotnet-ef --version 3.1.3'.
  • πŸ“ To access the command prompt, navigate to the project folder, type 'CMD' in the address bar, and press enter.
  • πŸ”Ž Use 'dotnet ef --help' to get a list of available commands and options for Entity Framework migrations.
  • πŸ“ The 'dotnet ef migrations' command is used to manage database context and migrations.
  • πŸš€ To add a migration, use the syntax 'dotnet ef migrations add [MigrationName]' where [MigrationName] is the name of the migration.
  • πŸ›  After adding a migration, use 'dotnet ef database update' to apply the changes to the database.
  • πŸ”„ The video demonstrates how to check for unrecognized commands or arguments and correct any spelling mistakes.
  • πŸ“š It shows how to use the 'dotnet ef database update' command to create a physical table in a local SQL Server database.
  • πŸ” The tutorial also covers how to check the database using SQL Server Management Studio to ensure the migration was successful.
  • πŸ“‹ Lastly, the video explains how to use the Package Manager Console for migrations with commands like 'Add-Migration' and 'Update-Database'.

Q & A

  • What is the main topic of the video?

    -The main topic of the video is demonstrating how to perform migration in Entity Framework using .NET Core CLI.

  • How can one download .NET EF globally?

    -To download .NET EF globally, use the command 'dotnet tool install --global dotnet-ef --version 3.1.3' in the CLI.

  • What is the purpose of opening the command prompt from the project folder?

    -Opening the command prompt from the project folder allows you to execute .NET EF commands related to that specific project.

  • How can viewers access the help section for .NET EF commands?

    -Viewers can access the help section for .NET EF commands by typing 'dotnet ef --help' in the command prompt.

  • What command is used to add a new migration?

    -The command used to add a new migration is 'dotnet ef migrations add' followed by the name of the migration.

  • What is the correct syntax for adding a migration in a .NET project?

    -The correct syntax is 'dotnet ef migrations add <MigrationName>' where <MigrationName> is the name you assign to the migration.

  • What command is used to update the database after adding a migration?

    -The command used to update the database is 'dotnet ef database update'.

  • How can one check for a spelling mistake in the commands?

    -One can check for spelling mistakes by referring back to the help section or by carefully reviewing the command syntax.

  • What does the video guide on checking the database after migration?

    -The video guides on checking the database by opening SQL Server Object Explorer and looking for the migration under the specified holder name.

  • What are the two methods demonstrated in the video for using migration in Entity Framework?

    -The two methods demonstrated are using .NET Core CLI and using the Package Manager Console.

  • How can one get help about Entity Framework in the Package Manager Console?

    -One can get help about Entity Framework by typing 'get-help about entity framework' in the Package Manager Console.

Outlines

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Mindmap

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Keywords

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Highlights

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Transcripts

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now
Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
Entity FrameworkDatabase MigrationsCLI CommandsPackage ManagerMigration TutorialDotnet EFData ManagementSoftware DevelopmentMigration ToolsTutorial Video