uBeac.Web.Common includes base controller, common action filters, application context and debugger implementation.
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.
Install the package with NuGet:
dotnet add package uBeac.Web.Common
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]
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 injectIApplicationContext.
Just put the following code in Program.cs:
builder.Services.AddDebugger();With this, wherever you need to work with the debugger, just inject
IDebugger.