{"id":29690234,"url":"https://github.com/raymondbrink/cleanarchitecture","last_synced_at":"2026-03-17T13:47:33.468Z","repository":{"id":84477024,"uuid":"458643510","full_name":"raymondbrink/CleanArchitecture","owner":"raymondbrink","description":"NetActive.CleanArchitecture is a set of libraries supporting Clean Architecture in .NET (6+)","archived":false,"fork":false,"pushed_at":"2025-01-15T12:37:08.000Z","size":525,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-07-22T07:22:35.954Z","etag":null,"topics":["autofac","automapper","cleanarchitecture","efcore6","fluentvalidation","linqkit","mediatr","net6"],"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/raymondbrink.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":"2022-02-12T21:27:39.000Z","updated_at":"2023-03-03T23:12:52.000Z","dependencies_parsed_at":"2023-09-28T21:29:06.596Z","dependency_job_id":"60d74d00-cf68-445a-ba3d-58b8d83a1a35","html_url":"https://github.com/raymondbrink/CleanArchitecture","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/raymondbrink/CleanArchitecture","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raymondbrink%2FCleanArchitecture","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raymondbrink%2FCleanArchitecture/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raymondbrink%2FCleanArchitecture/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raymondbrink%2FCleanArchitecture/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raymondbrink","download_url":"https://codeload.github.com/raymondbrink/CleanArchitecture/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raymondbrink%2FCleanArchitecture/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266626115,"owners_count":23958344,"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","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"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":["autofac","automapper","cleanarchitecture","efcore6","fluentvalidation","linqkit","mediatr","net6"],"created_at":"2025-07-23T06:06:23.892Z","updated_at":"2026-03-17T13:47:33.461Z","avatar_url":"https://github.com/raymondbrink.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NetActive.CleanArchitecture\nNetActive.CleanArchitecture is a set of libraries supporting Clean Architecture development in .NET (8+). \n\nSource code and [examples](https://github.com/raymondbrink/CleanArchitecture/tree/develop/examples) can be found on [GitHub](https://github.com/raymondbrink/CleanArchitecture). The NuGet packages, including debug symbols, can be found on [NuGet](https://www.nuget.org/packages?q=netactive.cleanarchitecture).\n\n## Quick Getting Started Guide\n\nThese libraries assume you have SQL Server Express LocalDB installed, but they work with any SQL Server version supported by Entity Framework Core.  \nYou can verify if you have SQL Server Express LocalDB installed by running this command:\n- `SqlLocalDB info`\n\nYou should get this response:\n```\nMSSQLLocalDB\n```\n\nIf you didn't, then first download and install [SQL Server Express LocalDB](https://msdn.microsoft.com/en-us/library/hh510202.aspx).\nOnce you have SQL Server Express LocalDB installed, you follow the simple steps below.\n\nYou will end-up with a new solution containing a basic console application, but the scaffolded Application, Domain and Persistence projects can also be used in Website or WebApi projects, like all the included example projects do.\n\n1. Open a .NET Core command line interface\n1. Install the solution template from NuGet:\n    - `dotnet new install NetActive.CleanArchitecture.Template`\n1. Create and navigate to an empty folder that will hold the Solution (by default the folder name will be used as the primary namespace):\n    - `dotnet new cleanarch-console` (add `-h` for more options)\n1. Navigate to the subfolder created, who's name ends with `.Console`\n1. Run the console application:\n    - `dotnet run`\n\nIt might take a few seconds to create the database. Then the output should be:\n```\nd87d6081-fdbd-42c7-9e8d-4d297410c6aa    some entity\nd730df59-bd8c-42d1-8133-6699aa47db42    some other entity\n51f2d429-9a53-44b5-9205-f02883ab8bbe    yet another entity\n\nEntity 'some entity' exists: True\n```\n\nAlternatively you can also run this command from the Package Manager Console:  \n- `PM\u003e Install-Package NetActive.CleanArchitecture.Template`  \n\nOnce installed you can choose the template from Visual Studio's `Create a new project` wizard, like any other installed solution or project template.\n\nYou can remove the solution template by running this command:  \n- `dotnet new uninstall NetActive.CleanArchitecture.Template`\n\n## Example Code\n\nBesides the source code you'll also find many practicle [examples](https://github.com/raymondbrink/CleanArchitecture/tree/develop/examples) on how to use these libraries in Console applications, Web applications or API's.\nHere's a quick example (from the `Example.Console.CommandAdd` example project) of what your application code could look like (excluding some global usings):\n\n```csharp\nusing Example.Application.Manufacturer.Configuration;\nusing Example.Application.Manufacturer.Commands.AddManufacturer;\nusing Example.Application.Manufacturer.Commands.AddManufacturer.Models;\n\n// Build a host.\nvar host = Host.CreateDefaultBuilder()\n    .ConfigureServices((hostContext, services) =\u003e\n    {\n        // Wire up our clean architecture dependencies.\n        services\n            .AddPersistenceDependencies\u003cExampleDbContext, IExampleUnitOfWork, ExampleUnitOfWork\u003e(\n                hostContext.Configuration.GetConnectionString(\"ExampleDbConnection1\"),\n                useLazyLoadingProxies: false,\n                options =\u003e\n                {\n                    options.RegisterRepository\u003cManufacturer, Guid\u003e();\n                })\n            .AddApplicationManufacturerDependencies();\n    })\n    .Build();\n\n// Create manufacturer model.\nvar manufacturerName = $\"My Manufacturer ({DateTime.Now:yyyyMMddHHmmsssmmm})\";\nvar manufacturerToAdd = new AddManufacturerCommandModel(manufacturerName)\n{\n    Contact =\n    {\n        FamilyName = \"Brink\",\n        GivenName = \"Raymond\" // Optional\n    }\n};\n\n// Execute add manufacturer command.\nvar result = await host.Services.GetRequiredService\u003cIAddManufacturerCommand\u003e().ExecuteAsync(manufacturerToAdd);\n\nConsole.WriteLine($\"Added: {result}: {manufacturerToAdd.ManufacturerName}\");\nConsole.WriteLine();\n```\n\n## Why create these libraries?\n\nInspired by the video series [Clean Architecture: Patterns, Practices and Principles](https://app.pluralsight.com/library/courses/clean-architecture-patterns-practices-principles/table-of-contents) on PluralSight by [Matthew Renze](https://github.com/matthewrenze), \nI started creating these libraries around the idea of Clean Architecture a few years ago.\n\nThe open source community has given me so much over the past decade, I decided it was time to give something back.\nSince I find them very practicle and I recently ported them to .NET 6 and Entity Framework Core 6,\nI felt it was the right time to share these Clean Architecture libraries with the rest of the world.\nThere're now fully compatible with .NET 8 and Entity Framework Core 8.\n\nFocus is on simplifying implementation of and support for these Clean Architecture patterns and practices in new .NET projects. \nThese libraries have already been under active development for a few years and applied in real life production applications many times.\n\nPlease check them out and feel free to share your thoughts and ideas by contacting me or submitting a pull request.\n\n## Background\n\nUnder the hood these libraries try to apply the following principles and patterns:\n\n- [Clean Code](http://cleancoder.com/files/cleanCodeCourse.md)\n- [Don't Repeat Yourself](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself)\n- SOLID:\n  - [Single Responsibility Principle](https://en.wikipedia.org/wiki/Single-responsibility_principle)\n  - [Open-Closed Principle](https://en.wikipedia.org/wiki/Open%E2%80%93closed_principle)\n  - [Liskov Substitution Principle](https://en.wikipedia.org/wiki/Liskov_substitution_principle)\n  - [Interface Segregation Principle](https://en.wikipedia.org/wiki/Interface_segregation_principle)\n  - [Dependency Inversion Principle](https://en.wikipedia.org/wiki/Dependency_inversion_principle)\n- [Command and Query Responsibility Segregation (CQRS)](https://martinfowler.com/bliki/CQRS.html)\n- [Facade Pattern](https://en.wikipedia.org/wiki/Facade_pattern)\n- [Factory Method Pattern](https://en.wikipedia.org/wiki/Factory_method_pattern)\n- [Repository and Unit of Work Patterns](https://docs.microsoft.com/en-us/aspnet/mvc/overview/older-versions/getting-started-with-ef-5-using-mvc-4/implementing-the-repository-and-unit-of-work-patterns-in-an-asp-net-mvc-application)\n\nIf you're a programmer and you haven't heared of these yet, please check out [Uncle Bob Martin](http://cleancoder.com/products) and [Martin Fowler](https://martinfowler.com/).\nYou might learn a thing or two ;-)\n\nCheck out these projects as they are priceless and essential for these libraries to shine:\n\n- [AutoMapper](https://github.com/AutoMapper/AutoMapper)\n- [Entity Framework Core](https://github.com/dotnet/efcore)\n- [FluentValidation](https://github.com/FluentValidation/FluentValidation)\n- [LINQKit](https://github.com/scottksmith95/LINQKit)\n\nHappy coding!\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraymondbrink%2Fcleanarchitecture","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraymondbrink%2Fcleanarchitecture","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraymondbrink%2Fcleanarchitecture/lists"}