Skip to content
This repository has been archived by the owner on Aug 17, 2022. It is now read-only.

Liquid Application Framework - Domain (DDD) base classes

License

Notifications You must be signed in to change notification settings

ava-innersource/Liquid.Domain-Deprecated

Repository files navigation

DEPRECATED No Maintenance Intended

This repo is no longer supported and will not receive any updates nor bug fixes, This code has been moved to the main Liquid repository and will be maintained there.

Liquid Application Framework - Domain

This repository is part of the Liquid Application Framework, a modern Dotnet Core Application Framework for building cloud native microservices.

The main repository contains the examples and documentation on how to use Liquid.

Liquid Domain

Quality Gate Status

This package contains the subsystem of Liquid responsible for abstracting behavior and injection of domain handlers.

Getting Started

To use this package, your command request must implement IRequest from MediatR, and your command handler must implement IRequestHandler .

using MediatR;
public class SampleRequest : IRequest<SampleResponse>
{
    //declare the parameters or body of the request here, if its needed.
}
public class SampleQueryHandler : IRequestHandler<SampleRequest, SampleResponse>
    {  

        public async Task<SampleResponse> Handle(SampleRequest request, CancellationToken cancellationToken)
        {
             return new SampleResponse("Hello World!");
        }
    }

If you want to validate the input before processing, it is as easy as implementing a class that inherits AbstractValidator from FluentValidation.

using FluentValidation;
 public class MyCommandValidator : AbstractValidator<MyCommand>
{
    public MyCommandValidator()
    {
        RuleFor(command => command.Name).NotEmpty();
    }
}

This package also provides a dependency injection extension method to register your domain handlers and Liquid Mediator Behaviors for validation and telemetry:

using Liquid.Domain.Extensions.DependencyInjection;
public void ConfigureServices(IServiceCollection services)
{
    services.AddLiquidHandlers(withTelemetry: true, withValidators: true, typeof(MyCommand).Assembly);
}

About

Liquid Application Framework - Domain (DDD) base classes

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages