เพิ่ม Code ในการแยก api ออกมาเป็น ClassLibrary และดึงไปใช้ในแต่ละ project
This commit is contained in:
parent
00f795483a
commit
ea6cfb0e98
6 changed files with 71 additions and 1 deletions
19
BMA.EHR.API.Command/BMA.EHR.API.Command.csproj
Normal file
19
BMA.EHR.API.Command/BMA.EHR.API.Command.csproj
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.1.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BMA.EHR.Infrastructure\BMA.EHR.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
20
BMA.EHR.API.Command/CommandAPIRegistration.cs
Normal file
20
BMA.EHR.API.Command/CommandAPIRegistration.cs
Normal file
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
21
BMA.EHR.API.Command/TestController.cs
Normal file
21
BMA.EHR.API.Command/TestController.cs
Normal file
|
|
@ -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<ResponseObject> Get()
|
||||
{
|
||||
return Success("Test", new { data = "11111" });
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue