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

هذا القسم متوفر فقط للمشتركين. يرجى الترقية للوصول إلى هذه الميزة.

قم بالترقية الآن

Mindmap

plate

هذا القسم متوفر فقط للمشتركين. يرجى الترقية للوصول إلى هذه الميزة.

قم بالترقية الآن

Keywords

plate

هذا القسم متوفر فقط للمشتركين. يرجى الترقية للوصول إلى هذه الميزة.

قم بالترقية الآن

Highlights

plate

هذا القسم متوفر فقط للمشتركين. يرجى الترقية للوصول إلى هذه الميزة.

قم بالترقية الآن

Transcripts

plate

هذا القسم متوفر فقط للمشتركين. يرجى الترقية للوصول إلى هذه الميزة.

قم بالترقية الآن
Rate This

5.0 / 5 (0 votes)

الوسوم ذات الصلة
Entity FrameworkDatabase MigrationsCLI CommandsPackage ManagerMigration TutorialDotnet EFData ManagementSoftware DevelopmentMigration ToolsTutorial Video
هل تحتاج إلى تلخيص باللغة الإنجليزية؟