Files
mixtape/zero.Api/Abstractions/ZeroApiController.cs
T
2022-03-04 13:06:50 +01:00

25 lines
828 B
C#

using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
namespace zero.Api.Abstractions;
[ApiController]
[ZeroAuthorize]
[ApiMetadataFilter]
[ApiResponseFilter]
[TypeFilter(typeof(ApiExceptionFilter))]
//[MiddlewareFilter(typeof(ApiUnhandledExceptionMiddlewareFilter))]
//[ServiceFilter(typeof(ModelStateValidationFilterAttribute))]
//[ServiceFilter(typeof(BackofficeFilterAttribute))]
public abstract class ZeroApiController : ControllerBase
{
IZeroMapper _mapper;
protected IZeroMapper Mapper => _mapper ?? (_mapper = HttpContext?.RequestServices?.GetService<IZeroMapper>());
IZeroContext _context;
protected IZeroContext ZeroContext => _context ?? (_context = HttpContext?.RequestServices?.GetService<IZeroContext>());
public ApiRequestHints Hints { get; protected set; } = new();
}