From ea6cfb0e983a911b921582a929e36276aac5430d Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Wed, 28 Jun 2023 11:20:58 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=20Code=20=E0=B9=83=E0=B8=99=E0=B8=81=E0=B8=B2=E0=B8=A3?= =?UTF-8?q?=E0=B9=81=E0=B8=A2=E0=B8=81=20api=20=E0=B8=AD=E0=B8=AD=E0=B8=81?= =?UTF-8?q?=E0=B8=A1=E0=B8=B2=E0=B9=80=E0=B8=9B=E0=B9=87=E0=B8=99=20ClassL?= =?UTF-8?q?ibrary=20=E0=B9=81=E0=B8=A5=E0=B8=B0=E0=B8=94=E0=B8=B6=E0=B8=87?= =?UTF-8?q?=E0=B9=84=E0=B8=9B=E0=B9=83=E0=B8=8A=E0=B9=89=E0=B9=83=E0=B8=99?= =?UTF-8?q?=E0=B9=81=E0=B8=95=E0=B9=88=E0=B8=A5=E0=B8=B0=20project?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BMA.EHR.API.Command.csproj | 19 +++++++++++++++++ BMA.EHR.API.Command/CommandAPIRegistration.cs | 20 ++++++++++++++++++ BMA.EHR.API.Command/TestController.cs | 21 +++++++++++++++++++ .../BMA.EHR.MetaData.Service.csproj | 1 + BMA.EHR.MetaData.Service/Program.cs | 2 ++ BMA.EHR.Solution.sln | 9 +++++++- 6 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 BMA.EHR.API.Command/BMA.EHR.API.Command.csproj create mode 100644 BMA.EHR.API.Command/CommandAPIRegistration.cs create mode 100644 BMA.EHR.API.Command/TestController.cs diff --git a/BMA.EHR.API.Command/BMA.EHR.API.Command.csproj b/BMA.EHR.API.Command/BMA.EHR.API.Command.csproj new file mode 100644 index 00000000..218c5f05 --- /dev/null +++ b/BMA.EHR.API.Command/BMA.EHR.API.Command.csproj @@ -0,0 +1,19 @@ + + + + net7.0 + enable + enable + + + + + + + + + + + + + diff --git a/BMA.EHR.API.Command/CommandAPIRegistration.cs b/BMA.EHR.API.Command/CommandAPIRegistration.cs new file mode 100644 index 00000000..18a4feea --- /dev/null +++ b/BMA.EHR.API.Command/CommandAPIRegistration.cs @@ -0,0 +1,20 @@ +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace BMA.EHR.API.Command +{ + public static class CommandAPIRegistration + { + public static IMvcBuilder RegisterCommandControllers(this IMvcBuilder builder) + { + Assembly assembly = typeof(CommandAPIRegistration).Assembly; + builder.AddApplicationPart(assembly); + return builder; + } + } +} diff --git a/BMA.EHR.API.Command/TestController.cs b/BMA.EHR.API.Command/TestController.cs new file mode 100644 index 00000000..1ba0286b --- /dev/null +++ b/BMA.EHR.API.Command/TestController.cs @@ -0,0 +1,21 @@ +using BMA.EHR.Domain.Common; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BMA.EHR.API.Command +{ + [Route("api/test")] + [ApiController] + public class TestController : BaseController + { + [HttpGet] + public ActionResult Get() + { + return Success("Test", new { data = "11111" }); + } + } +} diff --git a/BMA.EHR.MetaData.Service/BMA.EHR.MetaData.Service.csproj b/BMA.EHR.MetaData.Service/BMA.EHR.MetaData.Service.csproj index b693c053..d6b70739 100644 --- a/BMA.EHR.MetaData.Service/BMA.EHR.MetaData.Service.csproj +++ b/BMA.EHR.MetaData.Service/BMA.EHR.MetaData.Service.csproj @@ -37,6 +37,7 @@ + diff --git a/BMA.EHR.MetaData.Service/Program.cs b/BMA.EHR.MetaData.Service/Program.cs index 8ffee1d7..f70b13bd 100644 --- a/BMA.EHR.MetaData.Service/Program.cs +++ b/BMA.EHR.MetaData.Service/Program.cs @@ -1,3 +1,4 @@ +using BMA.EHR.API.Command; using BMA.EHR.Application; using BMA.EHR.Infrastructure; using BMA.EHR.Infrastructure.Persistence; @@ -83,6 +84,7 @@ var builder = WebApplication.CreateBuilder(args); { options.SuppressAsyncSuffixInActionNames = false; }) + .RegisterCommandControllers() .AddNewtonsoftJson(x => x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore); builder.Services.AddSwaggerGen(); diff --git a/BMA.EHR.Solution.sln b/BMA.EHR.Solution.sln index 1a2f8197..79b24ffb 100644 --- a/BMA.EHR.Solution.sln +++ b/BMA.EHR.Solution.sln @@ -13,7 +13,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.MetaData.Service", EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F3C2F68F-8DC8-45A3-825B-24F17867D380}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "API", "API", "{FA618F0C-1AF5-49AB-AE13-C020B403B64F}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Service", "Service", "{FA618F0C-1AF5-49AB-AE13-C020B403B64F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMA.EHR.API.Command", "BMA.EHR.API.Command\BMA.EHR.API.Command.csproj", "{FC7215BD-5651-4226-9210-8894E8FA8767}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -37,6 +39,10 @@ Global {939DD34A-C7AE-406E-B557-33F69AC64127}.Debug|Any CPU.Build.0 = Debug|Any CPU {939DD34A-C7AE-406E-B557-33F69AC64127}.Release|Any CPU.ActiveCfg = Release|Any CPU {939DD34A-C7AE-406E-B557-33F69AC64127}.Release|Any CPU.Build.0 = Release|Any CPU + {FC7215BD-5651-4226-9210-8894E8FA8767}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FC7215BD-5651-4226-9210-8894E8FA8767}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FC7215BD-5651-4226-9210-8894E8FA8767}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FC7215BD-5651-4226-9210-8894E8FA8767}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -47,6 +53,7 @@ Global {F83D3633-4A7A-432A-9E47-29378F4D175F} = {F3C2F68F-8DC8-45A3-825B-24F17867D380} {939DD34A-C7AE-406E-B557-33F69AC64127} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F} {FA618F0C-1AF5-49AB-AE13-C020B403B64F} = {F3C2F68F-8DC8-45A3-825B-24F17867D380} + {FC7215BD-5651-4226-9210-8894E8FA8767} = {F3C2F68F-8DC8-45A3-825B-24F17867D380} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {3111A492-1818-4438-B718-75199D8E779A}