- Visual Studio Code
- vscode-sqlite
- dotnet 6
- GitHub
$ dotnet new gitignore
$ dotnet new sln -n caCleanArchitecture
$ dotnet new classlib -o ./Core/Domain
$ dotnet sln add ./Core/Domain
caCleanArchitecture/Host/WebApi$ dotnet add reference ..\..\Core\Application\Application.csproj ..\..\Infra\Infrastructure\Infrastructure.csproj
- Adding
$ dotnet add package Microsoft.EntityFrameworkCore.SQLite
$ dotnet add package Microsoft.EntityFrameworkCore.SqlServer
$ dotnet add package Microsoft.EntityFrameworkCore.Design
$ dotnet add package Microsoft.EntityFrameworkCore.Tools
$ dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
$ dotnet add package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore
- Removing
$ dotnet remove package Microsoft.VisualStudio.Web.CodeGeneration.Design
https://docs.microsoft.com/en-us/ef/core/cli/dotnet
- Add migration
caCleanArchitecture/Infra/Infrastructure$ dotnet ef migrations add InitialDbCreation -s ../../Host/WebApi --verbose
caCleanArchitecture/Infra/Infrastructure$ dotnet ef migrations add AddProductTable -s ../../Host/WebApi --verbose
- Updating database
caCleanArchitecture/Infra/Infrastructure$ dotnet ef database update InitialDbCreation -s ../../Host/WebApi
caCleanArchitecture/Infra/Infrastructure$ dotnet ef database update -s ../../Host/WebApi
The Entity Framework tools version '6.0.3' is older than that of the runtime '6.0.4'. Update the tools for the latest features and bug fixes. See https://aka.ms/AAc1fbw for more information.
$ dotnet tool update --global dotnet-ef
By default, Nullable is enable on YOUR_PROJECT.csproj. Make the value as disable in order for the warning to disappear.
<Nullable>disable</Nullable>
$ git rm -r --cached .
$ git add .
$ git commit -m 'Removed all files that are in the .gitignore'
$ git push origin master
Use this Microsoft.EntityFrameworkCore namespace.
using Microsoft.EntityFrameworkCore
This async method lacks ‘await’ operators and will run synchronously. Consider using the ‘await’ operator to await non-blocking API calls, or ‘await Task.Run(…)’ to do CPU-bound work on a background thread.
return awit Task.FromResult<object>(null);