From 29b7516284e174f287742e3c65b2b6f073e049e4 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Fri, 15 May 2026 02:48:28 +0330 Subject: [PATCH] add Base Controllers ... --- Controllers/XBaseApiController.cs | 28 +++++++++++++++++++++++++ Controllers/XBaseApiV1Controller.cs | 32 +++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 Controllers/XBaseApiController.cs create mode 100644 Controllers/XBaseApiV1Controller.cs diff --git a/Controllers/XBaseApiController.cs b/Controllers/XBaseApiController.cs new file mode 100644 index 0000000..e5d61fc --- /dev/null +++ b/Controllers/XBaseApiController.cs @@ -0,0 +1,28 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using xCommons.Attributes; +using xCommons.Configurations; +using xCommons.Providers; + +namespace xCommons.Controllers { + /// + /// Base Api Controller + /// + [ApiController] + [RequireXPowered(true)] + [Route("api/[controller]")] + [Produces("application/json")] + public abstract partial class XBaseApiController : XBaseController + { + protected XBaseApiController( + ILogger logger, + XAppConfiguration appConfiguration, + XValidationProvider validationProvider + ) : base( + logger, + appConfiguration, + validationProvider + ) + { } + } +} \ No newline at end of file diff --git a/Controllers/XBaseApiV1Controller.cs b/Controllers/XBaseApiV1Controller.cs new file mode 100644 index 0000000..d889d96 --- /dev/null +++ b/Controllers/XBaseApiV1Controller.cs @@ -0,0 +1,32 @@ +using System; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using xCommons.Attributes; +using xCommons.Configurations; +using xCommons.Extensions; +using xCommons.Providers; +using xExceptions.Constants; + +namespace xCommons.Controllers { + /// + /// Base Api V1 Controller + /// + [ApiController] + [ApiVersion("1.0")] + [RequireXPowered(true)] + [Route("api/v{version:apiVersion}/[controller]")] + public abstract partial class XBaseApiV1Controller : XBaseApiController + { + protected XBaseApiV1Controller( + ILogger logger, + XAppConfiguration appConfiguration, + XValidationProvider validationProvider + ) : base( + logger, + appConfiguration, + validationProvider + ) + { } + } +} \ No newline at end of file