Blog

Blog posts on .NET, Azure, and more.

OData (Open Data Protocol) in ASP.NET 6.0

September 13, 2021 by Anuraj

OData AspNetCore

OData (Open Data Protocol) is an ISO/IEC approved, OASIS standard that defines a set of best practices for building and consuming RESTful APIs. This post is about implementing OData (Open Data Protocol) in ASP.NET 6.0. OData RESTful APIs are easy to consume. The OData metadata, a machine-readable description of the data model of the APIs, enables the creation of powerful generic client proxies and tools. Unfortunetly OData is not available as part of Minimal APIs. So first let’s create a Web API application using the dotnet new webapi command. Once you created the API project add reference of Microsoft.AspNetCore.OData package.

Working with DevOps friendly EF Core Migration Bundles

September 11, 2021 by Anuraj

EFCore DevOps

This post is about EF Core migration bundles, which is a devops friendly way to deploy your database migrations. Currently you can deploy your EF Core migrations either using Code Approach where is you can call the migrations with C# code and another approach is using generating scripts and deploying the scripts using SQL CLI tools - I did some one blog post on how to deploy your EF Core database changes in Azure DevOps - it is using the EF Core script approach. The scripting remains a viable option for migrations. For those who choose the code approach, and to mitigate some of the risks associated with the command line and application startup approaches, the EF Core team introduced the migration bundles in EF Core 6.0 Preview 7.

How to implement two-factor authentication in ASP.NET Core without Identity

September 04, 2021 by Anuraj

AspNetCore Security

This post is about implement two-factor authentication in ASP.NET Core without ASP.NET Core Identity. Two factor authentication adds an extra layer of security is to your account to prevent someone from logging in, even if they have your password. This extra security measure requires you to verify your identity using a randomized 6-digit code. If you’re ASP.NET Core identity, 2FA support is available out of the box. In this post, you will learn how to implement two factor authentication in ASP.NET Core without identity, for example - if your project is using Cookie authentication or a token based approach.

ASP.NET Core Web.config Transform for Production

September 01, 2021 by Anuraj

AspNetCore DevOps

This post is about enabling web.config transformation for deployment. Recently in one project I am working on I faced one issue. I had to enable some security configuration in the App Service - to remove Powered By header and Server header. These changes I did in the app service web.config. After another deployment it reverted back to default ASP.NET Core generated web.config file - when you execute the dotnet publish command - it will generated web.config file like this.

Continuous database deployment with GitHub Actions

August 19, 2021 by Anuraj

Azure DevOps EFCore GitHub Actions

This post is about enabling continuous database deployment with GitHub Actions for your ASP.NET Core applications with the help of EF Core migrations. I am following the EF Core migration script approach in this as well. But compared to Azure DevOps, I found GitHub actions is more fast. I am deploying an ASP.NET Core 5.0 application to Azure App Service and along with it I am deploying the database changes as well.

Copyright © 2024 Anuraj. Blog content licensed under the Creative Commons CC BY 2.5 | Unless otherwise stated or granted, code samples licensed under the MIT license. This is a personal blog. The opinions expressed here represent my own and not those of my employer. Powered by Jekyll. Hosted with ❤ by GitHub