Equinox Project Documentation

repository·master·Indexed 27 days ago

https://github.com/eduardopires/equinoxproject

An open-source .NET Core reference implementation demonstrating software architecture best practices, including DDD, CQRS, and Clean Code. Built with ASP.NET 9.0, Entity Framework Core 9.0, and NetDevPack, it showcases the implementation of Domain Driven Design, Unit of Work, and Repository patterns using SQLite.

Tokens
1K
Snippets
3
Records
7
Agent score
91%

What's inside Equinox Project

  1. Overview of Equinox Project technologies and architecture

    master

    The Equinox Project is an open-source .NET Core implementation designed to demonstrate best practices for building great applications. It implements a full architecture with separation of concerns, SOLID principles, and Clean Code.

    Core Technologies

    • ASP.NET 9.0: Includes MVC Core, WebApi Core with JWT Bearer Authentication, and Identity Core.
    • Entity Framework Core 9.0
    • NetDevPack: Implements DDD, CQRS, and Unit of Work.
    • NetDevPack.SimpleMediator: Used for lightweight, native CQRS handling (replaces MediatR).
    • Custom Automatic Mapping: Lightweight custom mapping extensions (replaces AutoMapper).
    • FluentValidator
    • Swagger UI: Includes built-in JWT support.
    • SQLite: Built-in support with automatic EF Core migrations (no setup required).
    • NetArchTest.Rules: Used for Architecture Tests.

    Architectural Patterns

    • Domain Driven Design (DDD): Uses Layers and the Domain Model Pattern.
    • CQRS: Immediate Consistency pattern.
    • Domain Patterns: Domain Events, Domain Notifications, and Domain Validations.
    • Data Patterns: Event Sourcing, Unit of Work, and Repository patterns.
  2. Setup the Equinox Project environment

    master

    To run or develop with the Equinox Project, ensure you have the following installed:

    1. Visual Studio: The latest version is recommended.
    2. .NET Core SDK: Ensure you have the latest SDK and the appropriate runtime version installed.
    3. Visual Studio Code: Supported on Windows, Linux, or MacOS.

    You can download the latest SDK and tools from https://dot.net/core or follow the Microsoft .NET Download Guide.

  3. Register a new customer using RegisterNewCustomerCommand

    master

    The RegisterNewCustomerCommand is used to initiate the registration process for a new customer within the Equinox domain. To instantiate this command, you must provide the customer's name, email address, and birth date.

    Before executing the command, you should call the IsValid() method. This method triggers validation logic via RegisterNewCustomerCommandValidation and populates the ValidationResult property, which indicates whether the provided data meets the required domain constraints.

  4. Handle UpdateCustomerCommand

    master

    Updates an existing customer's information. The handler validates the command, checks for email conflicts (ensuring the email isn't already taken by a different customer ID), updates the entity, and triggers a CustomerUpdatedEvent. Changes are committed via the repository's Unit of Work.

    public async Task<ValidationResult> Handle(UpdateCustomerCommand message, CancellationToken cancellationToken)
  5. Use UpdateCustomerCommand to update customer information

    master
    The UpdateCustomerCommand is used to trigger an update for an existing customer. It requires a unique identifier, the new name, a new email address, and the customer's birth date. Before executing the command, call IsValid() to ensure the provided data meets the domain validation rules defined in UpdateCustomerCommandValidation.
  6. Handle RegisterNewCustomerCommand

    master

    Processes the registration of a new customer. The handler validates the command, ensures the email is unique by checking the ICustomerRepository, creates a new Customer entity, and triggers a CustomerRegisteredEvent. If successful, it persists the customer via the repository's Unit of Work.

    public async Task<ValidationResult> Handle(RegisterNewCustomerCommand message, CancellationToken cancellationToken)