first commit
This commit is contained in:
16
MyNewProjectName.WebAPI/Controllers/BaseApiController.cs
Normal file
16
MyNewProjectName.WebAPI/Controllers/BaseApiController.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace MyNewProjectName.WebAPI.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// Base API controller with common functionality
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public abstract class BaseApiController : ControllerBase
|
||||
{
|
||||
private ISender? _mediator;
|
||||
|
||||
protected ISender Mediator => _mediator ??= HttpContext.RequestServices.GetRequiredService<ISender>();
|
||||
}
|
||||
Reference in New Issue
Block a user