|
Use keyed services in ASP.NET Core |
A few years ago I wrote an article describing how ASP.NET Core DI container behaves when multiple implementations of an interface are registered. It's time to revisit the concept because .NET 8 has something better to offer -- Keyed Services. I am going to use the same example that I used in the earlier article. We will modify the example for .NET 8. |
Posted On : 23 Sep 2024 |
|
Store connection string in Azure App Service and Azure Key Vault |
In the previous article you learned to deploy an ASP.NET Cor web app in an Azure App Service using two techniques. Recollect that we are storing the database connection string in the appsettings.json file. And we need to change it to match the production setup at the time of deployment. In this article we will discuss two better ways of storing the database connection string. Firstly, we will learn to store the connection string into the Azure App Service itself. And then we will store it in Azure Key Vault. |
Posted On : 02 Sep 2024 |
|
|
Use IExceptionHandler to handle errors in ASP.NET Core |
No matter how carefully you design your web pages and components there is always a possibility that your application throws an error at runtime. To trap and handle such unforeseen circumstances you can use IExceptionHandler interface introduced in ASP.NET Core 8. |
Posted On : 20 May 2024 |
|
|
|
Work with Web API and Class Library projects in Visual Studio Code |
In the previous article you learned to setup Visual Studio Code for ASP.NET Core development. We created ASP.NET Core MVC project and used scaffolding to create CRUD pages. In this article you will create a Web API that exposes the CRUD functionality to its client apps. You will also wrap the EF Core code inside a class library project. |
Posted On : 19 Feb 2024 |
|
Develop ASP.NET Core apps using Visual Studio Code |
Visual Studio Code or VS Code is a light weight IDE for modern web development. It supports a wide range of programming and scripting languages including C# and .NET Core. It has a very good extensions and libraries. If you are an ASP.NET developer familiar with Visual Studio and are looking to get introduced to Visual Studio Code this article is for you. |
Posted On : 06 Feb 2024 |
|
Use Endpoint Filters and Route Groups in Minimal APIs |
ASP.NET Core Minimal APIs allow you to quickly create controller-less HTTP APIs with minimal dependencies. A minimal API typically has an endpoint URL and an endpoint handler. At times you want to intercept an endpoint handler so that you can add pre and post processing to the endpoint handler. That's where Endpoint Filters come into picture. When there are too many endpoints, it makes sense to group them using a common URL prefix. This is taken care by Route Groups. In this article we will examine both with a few examples. |
Posted On : 16 Oct 2023 |
|
Show cascading dropdown lists in ASP.NET Core |
Many years ago I wrote a few articles on displaying cascading dropdown lists in ASP.NET. Since this is a very common requirement while building web UIs it's worthwhile to see how cascading dropdown lists can be displayed in ASP.NET Core MVC also. |
Posted On : 19 Jun 2023 |
|
|