{"id":13432262,"url":"https://github.com/kgrzybek/sample-dotnet-core-cqrs-api","last_synced_at":"2025-05-15T00:07:58.434Z","repository":{"id":38011585,"uuid":"168957647","full_name":"kgrzybek/sample-dotnet-core-cqrs-api","owner":"kgrzybek","description":"Sample .NET Core REST API CQRS implementation with raw SQL and DDD using Clean Architecture.","archived":false,"fork":false,"pushed_at":"2024-02-27T17:46:16.000Z","size":388,"stargazers_count":2959,"open_issues_count":14,"forks_count":658,"subscribers_count":112,"default_branch":"master","last_synced_at":"2025-04-13T21:33:57.747Z","etag":null,"topics":["clean-architecture","clean-code","cqrs","cqrs-simple","dapper","ddd","ddd-cqrs","ddd-example","design-patterns","design-systems","domain-driven-design","dotnercore","dotnet","entity-framework","entity-framework-core","mediatr","rest","rest-api","software-architecture"],"latest_commit_sha":null,"homepage":"https://www.kamilgrzybek.com/design/simple-cqrs-implementation-with-raw-sql-and-ddd/","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/kgrzybek.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":"2019-02-03T15:05:24.000Z","updated_at":"2025-04-13T13:15:10.000Z","dependencies_parsed_at":"2024-10-14T10:21:37.336Z","dependency_job_id":"07fee00c-2b1f-4828-ba97-eb76e03df45d","html_url":"https://github.com/kgrzybek/sample-dotnet-core-cqrs-api","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/kgrzybek%2Fsample-dotnet-core-cqrs-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgrzybek%2Fsample-dotnet-core-cqrs-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgrzybek%2Fsample-dotnet-core-cqrs-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgrzybek%2Fsample-dotnet-core-cqrs-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kgrzybek","download_url":"https://codeload.github.com/kgrzybek/sample-dotnet-core-cqrs-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254249198,"owners_count":22039029,"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":["clean-architecture","clean-code","cqrs","cqrs-simple","dapper","ddd","ddd-cqrs","ddd-example","design-patterns","design-systems","domain-driven-design","dotnercore","dotnet","entity-framework","entity-framework-core","mediatr","rest","rest-api","software-architecture"],"created_at":"2024-07-31T02:01:09.827Z","updated_at":"2025-05-15T00:07:53.405Z","avatar_url":"https://github.com/kgrzybek.png","language":"C#","funding_links":[],"categories":["Sample Projects","C\\#","Uncategorized","C#","例子","Architectural Style","Sample \u0026 Reference Applications"],"sub_categories":["Workflow","Uncategorized","工作流",".NET (C#/F#)","Clean Architecture"],"readme":"Sample .NET Core REST API CQRS implementation with raw SQL and DDD using Clean Architecture.\n==============================================================\n\n## CI\n\n![](https://github.com/kgrzybek/sample-dotnet-core-cqrs-api/workflows/Build%20Pipeline/badge.svg)\n\n## Give a Star! :star:\n\nIf you like this project, learn something or you are using it in your applications, please give it a star. Thanks!\n\n## Description\nSample .NET Core REST API application implemented with basic [CQRS](https://docs.microsoft.com/en-us/azure/architecture/guide/architecture-styles/cqrs) approach and Domain Driven Design.\n\n## Architecture [Clean Architecture](http://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html)\n\n![projects_dependencies](docs/clean_architecture.jpg)\n\n## CQRS\n\nRead Model - executing raw SQL scripts on database views objects (using [Dapper](https://github.com/StackExchange/Dapper)).\n\nWrite Model - Domain Driven Design approach (using Entity Framework Core).\n\nCommands/Queries/Domain Events handling using [MediatR](https://github.com/jbogard/MediatR) library.\n\n## Domain\n\n![projects_dependencies](docs/domain_model_diagram.png)\n\n## Validation\nData validation using [FluentValidation](https://github.com/JeremySkinner/FluentValidation)\n\nProblem Details for HTTP APIs standard implementation using [ProblemDetails](https://github.com/khellang/Middleware/tree/master/src/ProblemDetails)\n\n## Caching\nUsing Cache-Aside pattern and in-memory cache.\n\n## Integration\nOutbox Pattern implementation using [Quartz.NET](https://github.com/quartznet/quartznet)\n\n## Related blog articles\n\n[Simple CQRS implementation with raw SQL and DDD](http://www.kamilgrzybek.com/design/simple-cqrs-implementation-with-raw-sql-and-ddd/)\n\n[Domain Model Encapsulation and PI with Entity Framework 2.2](http://www.kamilgrzybek.com/design/domain-model-encapsulation-and-pi-with-entity-framework-2-2/)\n\n[REST API Data Validation](http://www.kamilgrzybek.com/design/rest-api-data-validation/)\n\n[Domain Model Validation](http://www.kamilgrzybek.com/design/domain-model-validation/)\n\n[How to publish and handle Domain Events](http://www.kamilgrzybek.com/design/how-to-publish-and-handle-domain-events/)\n\n[Handling Domain Events: Missing Part](http://www.kamilgrzybek.com/design/handling-domain-events-missing-part/)\n\n[Cache-Aside Pattern in .NET Core](http://www.kamilgrzybek.com/design/cache-aside-pattern-in-net-core/)\n\n[The Outbox Pattern](http://www.kamilgrzybek.com/design/the-outbox-pattern/)\n\n## How to run application\n1. Create empty database.\n2. Execute InitializeDatabase.sql script.\n2. Set connection string (in appsettings.json or by user secrets mechanism).\n3. Run!\n\n## How to run Integration Tests\n1. Create empty database.\n2. Execute InitializeDatabase.sql script.\n3. Set connection string using environment variable named `ASPNETCORE_SampleProject_IntegrationTests_ConnectionString`\n- Run tests from project [src/Tests/SampleProject.IntegrationTests](src/Tests/SampleProject.IntegrationTests)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkgrzybek%2Fsample-dotnet-core-cqrs-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkgrzybek%2Fsample-dotnet-core-cqrs-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkgrzybek%2Fsample-dotnet-core-cqrs-api/lists"}