Skip to content

A boilderplate for clean architecture implemented in .net core with automaticly generated generic repositories and CQRS

Notifications You must be signed in to change notification settings

Trigger2991/CleanArchitectureExample

 
 

Repository files navigation

Clean Architecture Example

This can act as a boilerplate for future projects It has implemented clean architecture with .Net Core 2.2 and EFCore

Generic repositories and IQueryable are automatically added to the DI Container for every entity in the DbContext All command handlers are automatically wired into the DI container A generic command invoker means you only need to inject the command invoker and create concrete classes for commands in your controllers Static Functions are used for queries, this may need to evolve to implementations of a query interface for more complex queries that require dependencies

Given that DbContexts are scoped each webrequest this means we are able to do away with the large UnitOfWork class This makes our dependencies more explicit in our constructor for our commands, e.g. It is obvious I am dependent on the StudentRepository not just the enitre database I have kept a unit of work class, but this is only used to act as a transaction factory, as transactions are IDisposables its a bit nicer to write using(var transaction = unitOfWork.BeginTransaction()) { ... } than it is to inject a transaction and call dispose explicitly, which is also avalable to you in the project.

About

A boilderplate for clean architecture implemented in .net core with automaticly generated generic repositories and CQRS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%