Skip to content

How to use ORM in DDD

Csaba Bernáth edited this page Jun 28, 2023 · 4 revisions

How to use ORM in DDD

Write model

  • Create the event sourced aggregate. The events will be replayed when saving aggregate to the SQL database.
  • Create the aggregate repository:
    • Save aggregate: replay events in SQL
      • Event store: append events to event stream (insert into Event select from json...)
      • State store:
        • Without object serialization: Create delete/insert/update SQL statements with Data Commander
        • With object serialization: delete/insert/update from/into table from json...)
    • Get aggregate by id:
      • create SQL statement manually
      • generate C# wrapper with Data Commander

Read model

  • Create SQL statement manually
  • Generate C# wrapper with Data Commander