{"id":37053307,"url":"https://github.com/andresantarosa/orchesflow","last_synced_at":"2026-01-14T06:00:56.209Z","repository":{"id":42080564,"uuid":"431991573","full_name":"andresantarosa/Orchesflow","owner":"andresantarosa","description":"Orchestration lib to be used along MediatR + EntityFramework","archived":false,"fork":false,"pushed_at":"2022-09-25T20:00:28.000Z","size":48,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-05T08:34:18.445Z","etag":null,"topics":["crqs","mediatr","nuget-package","unitofwork"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andresantarosa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-25T22:26:47.000Z","updated_at":"2023-04-22T14:21:59.000Z","dependencies_parsed_at":"2023-01-18T13:15:57.832Z","dependency_job_id":null,"html_url":"https://github.com/andresantarosa/Orchesflow","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/andresantarosa/Orchesflow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andresantarosa%2FOrchesflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andresantarosa%2FOrchesflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andresantarosa%2FOrchesflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andresantarosa%2FOrchesflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andresantarosa","download_url":"https://codeload.github.com/andresantarosa/Orchesflow/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andresantarosa%2FOrchesflow/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28412181,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T05:26:33.345Z","status":"ssl_error","status_checked_at":"2026-01-14T05:21:57.251Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crqs","mediatr","nuget-package","unitofwork"],"created_at":"2026-01-14T06:00:43.037Z","updated_at":"2026-01-14T06:00:56.172Z","avatar_url":"https://github.com/andresantarosa.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Orchesflow\n\nThis package provides some extra tools to be used along MediatR + EntityFramework focused to make working with events easier.\n\n#### Ochestrator flow:\n\n![Orchesflow diagram](https://i.imgur.com/ffI6xD1.png)\n\n### Using Ochesflow\nTo enable Orchesflow just add it to your `ConfigureServices()` method at `Startup.cs`\n````csharp\nservices.AddOrchesflow\u003cYourDbContext\u003e();\n````\n#### Sending a Command or Query\n````csharp\nusing Orchesflow.Orchestration\n\npublic class MyController {\n  private readonly IOrchestrator _orchestrator;\n\n  public MyController(IOrchestrator orchestrator) {\n    _orchestrator = orchestrator\n  }\n\n  public async Task \u003c IActionResult \u003e ([FromBody] MyCommand command) {\n    // Use SendCommand to send a command\n    // A command triggers PreCommitEvents, Database commit and AfterCommitEvents\n    // For Queries the method SendQuery() should be used\n    // SendQuery() does not trigger events nor database commit\n    var response = await _orchestrator.SendCommand(command);\n    if (respose.Success) \n       return Ok(response.Data);\n    else\n       return BadRequest(response.Messages);\n  }\n}\n````\n#### EventDispatcher\n### EventDispatcher\nThe event dispatcher is the responsible to dispatch PreCommitEvents and AfterCommitEvents. This interface (`IEventDispatcher`) provides methods to add, remove, list or manualy event trigger (not recommended).\nThe event dispatcher is the responsible to dispatch PreCommitEvents and AfterCommitEvents. This interface (`IEventDispatcher`) provides methods to add, remove, list or manualy event trigger (not recommended).\n##### Available methods for PreCommitEvents\n##### Available methods\n`GetPreCommitEvent(INotification evt)` =\u003e Returns a list with all PreCommitEvent\n\n`GetPreCommitEvent(INotification evt)` =\u003e Returns a list with all PreCommitEvent\n\n`AddPreCommitEvent(INotification evt)` =\u003e Adds new PreCommitEvent\n\n`AddPreCommitEvent(INotification evt)` =\u003e Adds new PreCommitEvent\n\n`RemovePreCommitEvent(INotification evt)` =\u003e Remove an existing PreCommitEvent\n\n`RemovePreCommitEvent(INotification evt)` =\u003e Remove an existing PreCommitEvent\n`FirePreCommitEvents(INotification evt)` =\u003e Manualy fire PreCommitEvent (not recommended)\n\n`FirePreCommitEvents(INotification evt)` =\u003e Manualy fire PreCommitEvent (not recommended)\n####  \n##### Available methods for PreCommitEvents\n`GetAfterCommitEvent(INotification evt)` =\u003e Returns a list with all AfterCommitEvent\n\n`GetAfterCommitEvent(INotification evt)` =\u003e Returns a list with all AfterCommitEvent\n\n`AddAfterCommitEvent(INotification evt)` =\u003e Adds new AfterCommitEvent\n\n`AddAfterCommitEvent(INotification evt)` =\u003e Adds new AfterCommitEvent\n\n`RemoveAfterCommitEvent(INotification evt)` =\u003e Remove an existing AfterCommitEvent\n\n`RemoveAfterCommitEvent(INotification evt)` =\u003e Remove an existing AfterCommitEvent\n\n`FireAfterCommitEvents(INotification evt)` =\u003e Manualy fire AfterCommitEvent (not recommended)\n\nThe EventDispatcher functionality is only available when using `SendCommand()`\n\n#### Commit\n`SaveChanges()` method is called whenever MediatR CommandHandler finishes its job, unless any notification is found at the DomainNotifications container.\nThe Commit will only be evoked when using `SendCommand()`\n\n#### PreCommitEvents\nPreCommitEvents are MediatR events (`INotification`) that will be triggered before commit occurs. An unlimited number of PreCommitEvents can be added to EventDispatcher.\nTo add a PreCommitEvent use `IEventDispatcher.AddPreCommitEvents()`\n\n#### AfterCommitEvents\nAfterCommitEvents are MediatR events (`INotification`) that will be triggered after the  commit occurs and if no notification is found at DomainNotifications container.. An unlimited number of PreCommitEvents can be added to EventDispatcher.\n\n#### DomainNotifications container\nThis container intention is to store any errors that occurs during the request lifecycle and provide easy access to them from any part of your code. It is important to note that Commit action, AfterCommitEvents and the flow return depends if there is or there is not messages at DomainNotifications container. This funcionality should be used whenever you want to prevent the Commit to happen or prevent AfterCommitEvents to be triggered.\n\n##### Available methods for IDomainNotifications interface\n\n`AddNotification(string notification)` =\u003e Adds a new notification to container\n\n`void CleanNotifications()` =\u003e Remove all notifications from container\n\n### Fallbacks\n\nSometimes things just go wrong, in this case you can use fallbacks to go back and undo what you did.\nTo enable fallbacks, implement the interface `IFallbackable` at your RequestHandler or Notification Handler and put your logic inside `Fallback()` method.\n\nThere are three key moments for fallbacks.\n\n- **An error occurred during a PreCommitEvent**: All PreCommitEvents already executed will have its fallback method called in the reverse order they were executed\n\n- **An error occurred during Commit phase:** The calling handler will have its `Fallback` method triggered and also all PreCommitEvents executed will have its fallback method called in the reverse order they were executed\n\n- **An error occurred during a AfterCommitEvent:** All PreCommitEvents already executed will have its `Fallback` method triggered, Handler fallback and PreCommitEvents fallbacks will also be triggered in the reverse worder they were executed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandresantarosa%2Forchesflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandresantarosa%2Forchesflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandresantarosa%2Forchesflow/lists"}