Skip to content

Room Create Sample

Endpoint、validation済みCommand、Handler、use case portの境界をまとめて確認するための最小例。 sourceは責務境界に集中した教材で、supporting typeやusingの一部を省略しているため独立projectとしてはcompileしない。

Demonstrates

  • EndpointはHTTP入力をCommandへ変換し、Handlerのapplication resultをHTTP Response DTOとtyped responseへmappingする。
  • HandlerはHTTP型やprovider SDK型へ依存しない。
  • domain上の値はValue ObjectでCommandへ渡す。
  • use case portは必要な永続化操作だけを公開し、同じCancellationTokenを受け取る。

Read

  1. RoomCreateEndpoint.cs
  2. RoomCreateRequestValidator.cs
  3. RoomCreateCommand.cs
  4. RoomCreateHandler.cs
  5. RoomCreateResult.cs
  6. IRoomCreateRepository.cs

Does not imply

  • すべてのHandlerにCommandが必要という意味ではない。
  • すべての作成処理にtransactionが必要という意味ではない。
  • 型名、route、response fieldをproductionへコピーするためのtemplateではない。
  • supporting type、using、DI registration、error mapping実装を省略しているため、このsample単体がcompile可能または規則を網羅する完全実装という意味ではない。
  • RFC 9457 error mappingとfail-fast filterの完全例は../rfc9457-errors/README.mdを読む。
  • sampleの一部分だけをコピーせず、作業対象に該当するreferences/を読んで規則を適用する。

規則とsampleが食い違う場合はreferences/を正とする。