.NET Training Batch 3

Custom Middleware https://learn.microsoft.com/en-us/aspnet/core/fundamentals/middleware/write?view=aspnetcore-7.0

Accessing DbContext in Middleware

This error is likely occurring because any middleware acts as a singleton. You have to avoid using member variables in your middleware. Feel free to inject into the Task Invoke, but don't store the inject value into a member object. https://stackoverflow.com/questions/33253834/accessing-dbcontext-in-middleware-in-asp-net-5

public async Task Invoke(HttpContext context, ApplicationDbContext applicationContext) // Method Injection
{
    await _next(context);
}
dotnet tool install --global dotnet-ef --version 7.0.17
 Scaffold-DbContext "Server=.;Database=TestDb;User ID=sa;Password=sasa@123;TrustServerCertificate=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -Context AppDbContext -Tables Tbl_PieChart
 Scaffold-DbContext "Server=.;Database=TestDb;User ID=sa;Password=sasa@123;TrustServerCertificate=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir EfCoreDataModels -Context AppDbContext -Tables Tbl_PieChart
 dotnet ef dbcontext scaffold "Server=.;Database=TestDb;User ID=sa;Password=sasa@123;TrustServerCertificate=True;" Microsoft.EntityFrameworkCore.SqlServer -o EfCoreDataModels -c AppDbContext -t Tbl_PieChart
CREATE TABLE [dbo].[Tbl_Atm](
	[AtmId] [int] IDENTITY(1,1) NOT NULL,
	[UserName] [nvarchar](50) NOT NULL,
	[Password] [nvarchar](50) NOT NULL,
	[CardNumber] [nvarchar](50) NOT NULL,
	[Balance] [decimal](20, 2) NOT NULL,
 CONSTRAINT [PK_Tbl_Atm] PRIMARY KEY CLUSTERED 
(
	[AtmId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO

MVC Model View Controller

Controller View(model - dto)

https://code.visualstudio.com/download

https port - 443 http port - 80

mssql port - 1433

Node.js https://www.youtube.com/watch?v=zb3Qk8SG5Ms&list=PL4cUxeGkcC9jsz4LDYc6kv3ymONOKxwBU

JSON Server https://www.youtube.com/watch?v=mAqYJF-yxO8&t=15s https://www.youtube.com/watch?v=VF3TI4Pj_kM

Express.js https://youtu.be/nH9E25nkk3I?si=5J4kCb3v28LW3uYD

React.js https://www.youtube.com/watch?v=j942wKiXFu8&list=PL4cUxeGkcC9gZD-Tvwfod2gaISzfRiP9d

React.js Crud using JSON placeholder https://youtu.be/Zhmuc_NFiO8?si=pAH5XDnoDpcHz8X7

https://github.com/reactiveui/refit https://restsharp.dev/

Alt text

Visual Studio 2022 Preview https://visualstudio.microsoft.com/vs/preview/

Ajax CRUD https://dev.to/duhbhavesh/how-to-use-fetch-api-for-crud-operations-57a0

fetch axios


  • Api Call [MVC]

    • HttpClient
    • RestClient
    • Refit
  • Minimal Api

  • Logging (Console App, Web Api)

    • Serilog
      • Text Logging
      • Db Logging
    • NLog
    • Log4net
  • Realtime Chat Message using SignalR

  • UI Design

  • Deploy on IIS

  • Realtime Chart App using SignalR

  • Middleware For MVC

  • Blazor Server CRUD

  • Blazor Web Assembly CRUD [Client CRUD, Server CRUD]

  • Deploy Blazor Web Assembly


  • GraphQL
  • gRPC

https://stackedit.io/app#

https://www.openapis.org/

https://developer.mozilla.org/en-US/docs/Web/HTTP/Status

Informational responses (100 – 199)
Successful responses (200 – 299)
Redirection messages (300 – 399)
Client error responses (400 – 499)
Server error responses (500 – 599)

image info

https://stackoverflow.com/questions/17615260/the-certificate-chain-was-issued-by-an-authority-that-is-not-trusted-when-conn

https://www.javatpoint.com/ado-net-tutorial

ado.net CRUD dapper ef core (code first, database first)

C#

.net framework (windows) 1 2 3 4 4.5 4.6 4.7 4.8

.net core (windows, linux, macos) 1 2 2.2 3 3.1

.net (windows, linux, macos) 5 (vs2019, vs2022) 6 (vscode, vs2022) 7 (current) 8 9 (beta)

  • console app [x]
  • windows forms
  • asp.net web forms
  • asp.net core web mvc [x]
  • asp.net core web api [x]

https://www.c-sharpcorner.com/article/introduction-to-nlog-with-asp-net-core2/ https://code-maze.com/aspnetcore-structured-logging-log4net/