{"id":23855479,"url":"https://github.com/jgauffin/dotnetcqs","last_synced_at":"2025-07-13T07:03:07.893Z","repository":{"id":17421164,"uuid":"20194214","full_name":"jgauffin/dotnetcqs","owner":"jgauffin","description":"Command/Query separation for .NET","archived":false,"fork":false,"pushed_at":"2023-10-04T19:44:34.000Z","size":1875,"stargazers_count":14,"open_issues_count":4,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-12-11T13:11:54.490Z","etag":null,"topics":["command-query","cqrs","csharp","dotnet","messaging","netstandard20","queues"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jgauffin.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-05-26T17:59:39.000Z","updated_at":"2022-04-17T23:38:35.000Z","dependencies_parsed_at":"2024-06-21T20:22:43.273Z","dependency_job_id":"02b3aeba-dd9d-40de-99f1-bdb4349b8c4d","html_url":"https://github.com/jgauffin/dotnetcqs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgauffin%2Fdotnetcqs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgauffin%2Fdotnetcqs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgauffin%2Fdotnetcqs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgauffin%2Fdotnetcqs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jgauffin","download_url":"https://codeload.github.com/jgauffin/dotnetcqs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232275369,"owners_count":18498274,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["command-query","cqrs","csharp","dotnet","messaging","netstandard20","queues"],"created_at":"2025-01-03T00:57:30.084Z","updated_at":"2025-01-03T00:57:30.664Z","avatar_url":"https://github.com/jgauffin.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"Asynchronous Command/Query library\n===================================\n\nThis library contains interfaces used to be able to use messaging (commands, queries and events) in applications without tightly coupling it to a specific implementation.\n\n## Example\n\nDefine a message:\n\n```csharp\npublic class ActivateAccount\n{\n\tpublic int AccountId {get; set; }\n\tpublic string ActivationKey { get; set; }\n}\n```\n\nInvoke it:\n\n```csharp\nvar msg = new ActivateAccount { AccountId = 35, ActivationKey = \"dfkldsie93kcn22\" };\nawait _messageBus.SendAsync(msg);\n```\n\nHandle it:\n\n```csharp\npublic class ActivateAccountHandler : IMessageHandler\u003cActivateAccount\u003e\n{\n    private readonly IAccountRepository _repository;\n\t\n\tpublic ActivateAccountHandler(IAccountRepository repository)\n\t{\n\t\tif (repository == null) throw new ArgumentNullException(repository);\n\t\t\n\t\t_repository = repository;\n\t}\n\t\n\tpublic async Task HandleAsync(IMessageContext context, ActivateAccount message)\n\t{\n\t\tvar user = await _repository.Get(message.AccountId);\n\t\tuser.Activate(message.ActivationKey);\n\t\tawait _repository.UpdateAsync(user);\n\t\t\n\t\tawait context.SendAsync(new AccountActivated(message.AccountId));\n\t}\n}\n```\n\nMessage handlers are fully isolated from the rest of the specification and therefore easy to test and maintain.\n\n\n# Implementations\n\nThe following implementations exist.\n\n## Bus \n\nThe `MessageBus` and `QueryBus` currently have the following implementations:\n\n* DependenyInjection: Use your favorite container to execute and queue messages.\n * Microsoft.Extensions.DependencyInjection: Currently under implementation\n * Griffin.Container: Currently under implementation\n\n## Queues\n\n* ADO.NET: Uses a table in your database to enqueue and dequeue messages (to get persistance).\n* Azure ServiceBus: Under development\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgauffin%2Fdotnetcqs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjgauffin%2Fdotnetcqs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgauffin%2Fdotnetcqs/lists"}