Tolitech / CodeGenerator.Domain

Domain library used in projects created by the Code Generator tool.

Home Page:https://www.tolitech.com.br

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tolitech.CodeGenerator.Domain

Domain library used in projects created by the Code Generator tool.

This project contains abstract base classes, interfaces and markup interfaces to standardize and facilitate the implementation of projects generated by the Tolitech Code Generator tool.

Tolitech Code Generator Tool: http://www.tolitech.com.br

Examples:

public class Person : Entity
{
    public Person(string? name)
    {
        Name = name;
    }

    public string? Name { get; private set; }
}
public interface IPersonRepository : IRepository
{
    NotificationResult Insert(Person entity);

    IEnumerable<Person> Get();
}
public class InsertCommand : Command
{
    public string? Name { get; set; }
}
public class InsertCommandHandler : CommandHandler
{
    private readonly IPersonRepository _personRepository;

    public InsertCommandHandler(IPersonRepository personRepository)
    {
        _personRepository = personRepository;
    }

    public NotificationResult Handle(InsertCommand command)
    {
        var person = new Entities.Person(command.Name);
        var result = _personRepository.Insert(person);
        return result;
    }
}
public class GetAllQueryHandler : QueryHandler
{
    private readonly IPersonRepository _personRepository;

    public GetAllQueryHandler(IPersonRepository personRepository)
    {
        _personRepository = personRepository;
    }

    public IEnumerable<GetAllQueryResult> Handle(GetAllQuery query)
    {
        var result = new List<GetAllQueryResult>();

        var items = _personRepository.Get();

        foreach (var item in items)
        {
            result.Add(new GetAllQueryResult
            {
                Name = item.Name
            });
        }

        return result;
    }
}

About

Domain library used in projects created by the Code Generator tool.

https://www.tolitech.com.br

License:MIT License


Languages

Language:C# 100.0%