Category Archives: Dot Net

Azure AD Token Authentication Web API

Authentication example: Where AzureAdOptions contains the configuration of your Azure AD. MyJwtEventsHandler is the implementation of JwtEventsHandler. e.g. Register authentication: MyAuthorizationMiddlewareResultHandler is the middleware behaviour overrider. Check Microsoft docs for more details. Use on your controller: Cheers and Peace out!!!

Design time services .Net

Sometimes we need to override the process of model creation in the DB first approach. Maybe we want to create a base class for some common functionality of all the models. So, what we could do is, use the Design Time Services: Design-time services – EF Core | Microsoft Learn. We could use ‘Custom Reverse

Read More

.Net 8 IExceptionHandler

Before this we used to use a filter (GlobalExceptionFilter) to handle exceptions at one place. .Net 8 has a new IExceptionFilter middleware which can be used to filter the exceptions. For more look at: Handle errors in ASP.NET Core | Microsoft Learn The new exception handler keeps information in Features property. So, If you face

Read More

Scaffold Command line MAC

In the above command, ‘ConnectionString’ is the string that you use to connect with sql server. ‘Provider’ is the driver (nuget package) that will help you to interact with the sql server. e.g. for MySQL we could use ‘Pomelo.EntityFrameworkCore.MySql’ nuget package, for MSSQL we could use ‘Microsoft.EntityFrameworkCore.SqlServer’