본문으로 건너뛰기

어댑터 구현 결과

var builder = WebApplication.CreateBuilder(args);
builder.Services
.RegisterAdapterPresentation()
.RegisterAdapterPersistence(builder.Configuration)
.RegisterAdapterInfrastructure(builder.Configuration);
var app = builder.Build();
app.UseAdapterPresentation();
app.Run();

3개 Adapter 등록 메서드가 Builder 체인으로 구성됩니다. 각 Adapter는 독립적으로 등록되어 교체 가능합니다.

AiGovernance (Host)
├── AiGovernance.Adapters.Presentation → Application
├── AiGovernance.Adapters.Persistence → Application, Domain
└── AiGovernance.Adapters.Infrastructure → Application, Domain
AiGovernance.Application → Domain
AiGovernance.Domain → Functorium (Framework)

FastEndpoints 기반 HTTP API를 제공합니다.

영역엔드포인트HTTP 메서드경로 패턴
모델RegisterModelEndpointPOST/api/models
모델GetModelByIdEndpointGET/api/models/{id}
모델SearchModelsEndpointGET/api/models
모델ClassifyModelRiskEndpointPUT/api/models/{id}/risk
배포CreateDeploymentEndpointPOST/api/deployments
배포GetDeploymentByIdEndpointGET/api/deployments/{id}
배포SearchDeploymentsEndpointGET/api/deployments
배포SubmitForReviewEndpointPOST/api/deployments/{id}/submit
배포ActivateDeploymentEndpointPOST/api/deployments/{id}/activate
배포QuarantineDeploymentEndpointPOST/api/deployments/{id}/quarantine
평가InitiateAssessmentEndpointPOST/api/assessments
평가GetAssessmentByIdEndpointGET/api/assessments/{id}
인시던트ReportIncidentEndpointPOST/api/incidents
인시던트GetIncidentByIdEndpointGET/api/incidents/{id}
인시던트SearchIncidentsEndpointGET/api/incidents

합계: 15개 엔드포인트 (모델 4, 배포 6, 평가 2, 인시던트 3)

InMemory 구현으로 Repository와 Query를 제공합니다.

구현체포트Observable 래퍼
AIModelRepositoryInMemoryIAIModelRepositoryAIModelRepositoryInMemoryObservable
DeploymentRepositoryInMemoryIDeploymentRepositoryDeploymentRepositoryInMemoryObservable
AssessmentRepositoryInMemoryIAssessmentRepositoryAssessmentRepositoryInMemoryObservable
IncidentRepositoryInMemoryIIncidentRepositoryIncidentRepositoryInMemoryObservable
UnitOfWorkInMemoryIUnitOfWorkUnitOfWorkInMemoryObservable
AIModelQueryInMemoryIAIModelQueryAIModelQueryInMemoryObservable
ModelDetailQueryInMemoryIModelDetailQueryModelDetailQueryInMemoryObservable
DeploymentQueryInMemoryIDeploymentQueryDeploymentQueryInMemoryObservable
DeploymentDetailQueryInMemoryIDeploymentDetailQueryDeploymentDetailQueryInMemoryObservable
IncidentQueryInMemoryIIncidentQueryIncidentQueryInMemoryObservable

합계: 10개 구현체 (Repository 4, UnitOfWork 1, Query 5)

설정에 따라 Sqlite(EfCore) 구현으로 전환 가능하도록 PersistenceOptions.Provider로 분기합니다.

구현체포트Observable 래퍼
AIModelRepositoryEfCoreIAIModelRepositoryAIModelRepositoryEfCoreObservable
DeploymentRepositoryEfCoreIDeploymentRepositoryDeploymentRepositoryEfCoreObservable
AssessmentRepositoryEfCoreIAssessmentRepositoryAssessmentRepositoryEfCoreObservable
IncidentRepositoryEfCoreIIncidentRepositoryIncidentRepositoryEfCoreObservable
UnitOfWorkEfCoreIUnitOfWorkUnitOfWorkEfCoreObservable

EfCore 합계: 5개 구현체 (Repository 4, UnitOfWork 1)

EfCore 구현에서 Query는 InMemory 쿼리를 재사용합니다 (향후 Dapper 쿼리로 교체 가능).

외부 서비스(IO 고급 기능)와 파이프라인을 제공합니다.

구현체포트IO 패턴
ModelHealthCheckServiceIModelHealthCheckServiceTimeout(10s) + Catch
ModelMonitoringServiceIModelMonitoringServiceRetry(exponential, 3회) + Catch
ParallelComplianceCheckServiceIParallelComplianceCheckServiceFork + awaitAll
ModelRegistryServiceIModelRegistryServiceBracket(Acquire/Use/Release)

합계: 4개 외부 서비스

등록 항목:

  • Mediator + ObservableDomainEventNotificationPublisher
  • FluentValidation (2개 어셈블리)
  • OpenTelemetry 3-Pillar
  • Pipeline (UseObservability + UseValidation + UseException + Custom)
  • Domain Services (RiskClassificationService, DeploymentEligibilityService)

단위 테스트 (AiGovernance.Tests.Unit)

섹션 제목: “단위 테스트 (AiGovernance.Tests.Unit)”
범주테스트 파일 수테스트 대상
Value Objects1516종 VO의 생성, 검증, Smart Enum 전이
Aggregates4AIModel, ModelDeployment, ComplianceAssessment, ModelIncident
Domain Services1RiskClassificationService
Architecture3도메인/애플리케이션 아키텍처 규칙, 레이어 의존성
합계23

통합 테스트 (AiGovernance.Tests.Integration)

섹션 제목: “통합 테스트 (AiGovernance.Tests.Integration)”
범주테스트 파일 수테스트 대상
Models3Register, GetById, Search 엔드포인트
Deployments2Create, Workflow(전체 라이프사이클) 엔드포인트
Assessments1Initiate 엔드포인트
Incidents1Report 엔드포인트
합계7

전체 테스트 파일: 30개 (전체 솔루션 기준 268개 테스트가 2개 어셈블리에서 실행됩니다)

samples/ai-model-governance/
├── ai-model-governance.slnx
├── Directory.Build.props
├── Directory.Build.targets
├── domain/ # 도메인 레이어 문서 (4개)
├── application/ # 애플리케이션 레이어 문서 (4개)
├── adapter/ # 어댑터 레이어 문서 (4개)
├── Src/
│ ├── AiGovernance.Domain/ # 도메인 레이어
│ │ ├── SharedModels/Services/ # Domain Services (2종)
│ │ └── AggregateRoots/ # Aggregates (4종)
│ │ ├── Models/ # AIModel + VOs(4) + Specs(2)
│ │ ├── Deployments/ # ModelDeployment + VOs(4) + Specs(3)
│ │ ├── Assessments/ # ComplianceAssessment + Child Entity + VOs(3) + Specs(3)
│ │ └── Incidents/ # ModelIncident + VOs(4) + Specs(4)
│ ├── AiGovernance.Application/ # 애플리케이션 레이어
│ │ └── Usecases/ # Commands(8) + Queries(7) + EventHandlers(2) + Ports(9)
│ ├── AiGovernance.Adapters.Persistence/ # 영속성 어댑터
│ │ ├── Repositories/ # Aggregate별 Repository/Query 구현 (10종)
│ │ └── Registrations/
│ ├── AiGovernance.Adapters.Infrastructure/ # 인프라 어댑터
│ │ ├── ExternalServices/ # IO 고급 기능 (4종)
│ │ └── Registrations/
│ ├── AiGovernance.Adapters.Presentation/ # 프레젠테이션 어댑터
│ │ ├── Endpoints/ # FastEndpoints (15종)
│ │ └── Registrations/
│ └── AiGovernance/ # Host
│ └── Program.cs
└── Tests/
├── AiGovernance.Tests.Unit/ # 단위 테스트 (23개 파일)
└── AiGovernance.Tests.Integration/ # 통합 테스트 (7개 파일)
항목수량
Aggregate Root4
Child Entity1
Value Object16 (문자열 6, 비교 가능 2, Smart Enum 8)
Domain Service2
Specification12
Domain Event18
Command8
Query7
Event Handler2
Repository (Port)4
Query Port5
External Service Port4
HTTP Endpoint15
InMemory 구현체10
IO 고급 패턴4 (Timeout, Retry, Fork, Bracket)
Observable Port19 (InMemory 5, EfCore 5, Query 5, ExternalService 4)
단위 테스트 파일23
통합 테스트 파일7
총 테스트 파일30
총 테스트 수268