Skip to content

Latest commit

 

History

History

README.md

uBeac.Web.Common: A common library for your ASP.NET Core projects

Nuget version Nuget downloads

uBeac.Web.Common includes base controller, common action filters, application context and debugger implementation.

Why use?

Probably the first thing you do after creating an ASP.NET Core project is to create a base controller and define action filters. Well use uBeac.Web.Common instead. Also, this package provides an implementation of application context and debugger which we will use in the following and you will understand their use.


Start

Install the package with NuGet:

dotnet add package uBeac.Web.Common

Implement your controllers

You can inherit from BaseController to implement your controllers:

public class YourApiController : BaseController
{
}

This will apply the routing pattern and action filters to the controller by default.

  • Default routing pattern is API/[controller]/[action]

Add application context

Just put the following code in Program.cs:

builder.Services.AddApplicationContext();

With this, wherever you need application context properties (TraceId, UniqueId, SessionId, UserName, UserIp, Language), just inject IApplicationContext.


Add debugger

Just put the following code in Program.cs:

builder.Services.AddDebugger();

With this, wherever you need to work with the debugger, just inject IDebugger.