Skip to content

nightBaker/ProjectTemplate

Repository files navigation

Prerequisites

  • .NET 6
  • Docker (optionaly for databases)

How to use

NuGet Badge

  • Install template
    dotnet new --install NightBaker.ProjectTemplate
  • You should see dotnet new templates

  • Create new project

dotnet new CleanBlazor  -n <ProjectName>
  • Run and create databases with docker (or just use your databases)
cd docker
docker-compose up
  • Finally, run app

Standart onion vs blazor onion

blazor onion

As you can see, we want to share enums and exceptions from domain layer, DTOs from application layer with blazor project. Therefore, we've added extra DTO class library for each layer.

Domain

IAggregateRoot

Interface stands for defining aggregate root. Therefore, IRepository can work only with aggregates as well as IUnitOfWork.

Entity

Any domain object is entity. Entity has ability to raise events.

Domain event

Domain event implements INotification abstraction from Mediatr. Finally, we use mediator to publish and hand such events. We have two abstractions of event (INotification) : IPreSaveEvent and IPostSaveEvent for providing more managable behaviour. For more details, refer to Persistence layer section.

Value object

Value object is immutable object with ovverided equality methods, so they are compared by property values.