Distributed systems

Dotnet tooling

Wiki for Designing a restful api

dotnet tool install --global dotnet-ef
dotnet tool update --global dotnet-ef
dotnet tool list -g
dotnet --version
dotnet info
// Method inside Startup.cs for updating the db automatically
private static void UpdateDatabase(IApplicationBuilder app, IWebHostEnvironment env,  IConfiguration configuration)
        using var serviceScope = app.ApplicationServices

        using var ctx = serviceScope.ServiceProvider.GetService<ApplicationDbContext>();

        // ctx.Database.EnsureDeleted();

Generating apis

Updating database and running mingrations

dotnet ef migrations add Initial --project DAL --startup-project WebApp
dotnet ef database update --project DAL --startup-project WebApp

dotnet ef database drop --project DAL --startup-project WebApp

Generating views and controllers

dotnet aspnet-codegenerator controller -name PersonsController -actions -m Person -dc ApplicationDbContext -outDir Controllers --useDefaultLayout --useAsyncActions --referenceScriptLibraries -f

Generating Razor pages

dotnet aspnet-codegenerator razorpage -m TodoTask -dc AppDbContext -udl -outDir Pages/TodoTasks --referenceScriptLibraries -f

Bash script for generating dotnet sln with multiple projects inside it.

Directory.Build.props. - Enable the latest language features.