mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-04-11 19:02:15 +08:00
25 lines
627 B
C#
25 lines
627 B
C#
using Asp.Versioning;
|
|
using MediatR;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace BuildingBlocks.Web;
|
|
|
|
using MapsterMapper;
|
|
|
|
[Route(BaseApiPath)]
|
|
[ApiController]
|
|
[ApiVersion("1.0")]
|
|
public abstract class BaseController : ControllerBase
|
|
{
|
|
protected const string BaseApiPath = "api/v{version:apiVersion}";
|
|
private IMapper _mapper;
|
|
|
|
private IMediator _mediator;
|
|
|
|
protected IMediator Mediator =>
|
|
_mediator ??= HttpContext.RequestServices.GetService<IMediator>();
|
|
|
|
protected IMapper Mapper => _mapper ??= HttpContext.RequestServices.GetService<IMapper>();
|
|
}
|