Understanding and working with ASP.NET Core 6.0 Minimal API ⚙️

ExecuteAutomation
ExecuteAutomation
Published in
2 min readJul 28, 2021

ASP.NET Core Minimal API is a low footprint and super mini-sized project type that helps to develop an API with less code. As ASP.NET Core Minimal API uses the power of C# 9 and .NET 6.0 the code looks elegant with Top Level statement and Lambda Attributes of C#

Comparison of ASP.NET Web API project vs ASP.NET Minimal API

As you can see, the ASP.NET core Minimal API project has just Program.cs file as opposed to Controllers, Startup and Program.cs files.

Program.cs file and its code

The program.cs file looks super simple with just 9 lines of code to run an API with lot of missing extra ceremony required to boot a code as shown below

Top Level Statement

Top-level statements enable you to avoid the extra ceremony required by placing your program’s entry point in a static method in a class.

Starting in C# 9, you don’t have to explicitly include a Main method in a console application project/Web API minimal. Instead, you can use the top-level statements feature to minimize the code you have to write

Extra controller code

Complete discussion

Here is the complete discussion in the video below

https://youtu.be/Z4bINJudHX8

Thanks for reading the post and watching the video, hope you like them !

Thanks,

Karthik KK

--

--

ExecuteAutomation
ExecuteAutomation

ExecuteAutomation Ltd is a Software testing and its related information service company founded in 2020. Info available in YouTube and Udemy as video courses .