Skip to content

andrewjpoole/event-sourced-but-flow-driven-example

Repository files navigation

event-sourced-but-flow-driven-example

An example repo which uses fluent method chaining and domain events to achieve an eventsourced but flow-driven architecture

I use it to try things out, to demonstrate things in talks and to share with anyone who might find it useful.

Interesting things in this repo:

  • Fluent method chaining to create super clear orchestration code CollectedWeatherDataOrchestrator
  • Use of OneOf discriminated unions library to avoid use of exceptions for non-exception scenarios CreateResponseFor()
  • E2e component tests (lots of cool stuff in here😁) here
    • Using FakeTimeProvider to control the time during tests here
  • Retryable Dapper db connection with transactions here
  • Event sourcing using a SQL table of domain events here
  • Aspire providing a sublime local dev experience appHost here
  • OTEL tracing here
  • Integration tests with Aspire here Using trace data for assertions - lots more to come on this!
  • A Source Generator which will take constants and place them in an immutable dictionary in a partial class, for classes decorated with an attribute, very handy for service bus Type -> entity name mapping 😊 here

Scenario outline

scenario components

Scenario Happy Path Sequence

scenario happy path sequence

Talks

Fluent Method Chaining in C# and orchestration code so clear your product owner can read it!

London .Net User Group, November 2024, YouTube

How to fall in love with automated tests!

PDF of slides from DDDSouthWest 2025

Unit Test Complex E2E Flows + Integration Integration Testing with Aspire & OTEL

PDF of slides from DotNet SouthWest 2025/09/09

About

An example repo which uses fluent method chaining and domain events to achieve an eventsourced but flow-driven architecture

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published