- Clone the repository: https://github.com/ashuhatkar/ashulearn-webapi-sqlserver-efcore-msnugetpkg-crud-v8.0.1
- (Windows only) Install Visual Studio. Visual Studio contains tooling support for .NET Aspire that you will want to have. Visual Studio 2022 version 17.9 Preview.
- During installation, ensure that the following are selected:
ASP.NET and web development
workload..NET Aspire SDK
component in Individual components.
- During installation, ensure that the following are selected:
- Install the latest .NET 8 SDK
- On Mac/Linux (or if not using Visual Studio), install the Aspire workload with the following commands:
dotnet workload update
dotnet workload install aspire
dotnet restore <project>.sln
- Install and configure Docker desktop. It's free to use as a part of the Docker Personal subscription for individuals non-commercial open-source projects.
Warning
Remember to ensure that Docker is started
- Run SQL Server 2022 container image with Docker
- (Windows only) Run the application from Visual Studio:
- Open the project
src/Services/Nfs.Catalog/src/Nfs.Catalog.sln
file in Visual Studio - Ensure that
Nfs.Catalog.Service.csproj
is your startup project - Hit Ctrl-F5 to launch Aspire
- Or run the application from your terminal:
dotnet run --project src/Services/Nfs.Catalog/src/Nfs.Catalog.Service/Nfs.Catalog.Service.csproj
Now listening on: https://localhost:7179
- Configure local kubernetes
- Cloud infrastructure subscription
The Entity Framework Core tools help with design-time development tasks. They're primarily used to manage Migrations and to scaffold a DbContext and entity types by reverse engineering the schema of a database.
Microsoft.EntityFrameworkCore.Design is for cross-platform command line tooling.
Microsoft.EntityFrameworkCore.Design
contains all the design-time logic for Entity Framework Core. It's the code that all of the various tools (PMC cmdlets like Add-Migration
, dotnet ef
& ef.exe
) call into.
If you don't use Migrations or Reverse Engineering, you don't need it.
And when you do need it, we encourage PrivateAssets="All"
so it doesn't get published to the server where you almost certainly won't need it.
Before using the tools:
- Understand the difference between target and startup project.
- Learn how to use the tools with .NET Standard class libraries.
- For ASP.NET Core projects, set the environment.
PMC Command | Usage |
---|---|
Get-Help entityframework | Displays information about entity framework commands. |
Add-Migration | Creates a migration by adding a migration snapshot. |
Bundle-Migration | Creates an executable to update the database. |
Get-DbContext | Gets information about a DbContext type. |
Drop-Database | Drops the database. |
Get-Migration | Lists available migrations. |
Optimize-DbContext | Generates a compiled version of the model used by the DbContext . |
Remove-Migration | Removes the last migration snapshot. |
Scaffold-DbContext | Generates a DbContext and entity type classes for a specified database. This is called reverse engineering. |
Script-DbContext | Generates a SQL script from the DbContext. Bypasses any migrations. |
Script-Migration | Generates a SQL script using all the migration snapshots. |
Update-Database | Updates the database schema based on the last migration snapshot. |
If you encounter a bug or issues with this package,you can open an Github issue. For more details, see getting support.