NotSoAutoMapper.Extensions.Ioc.DependencyInjection

A NotSoAutoMapper extension to support Microsoft.Extensions.DependencyInjection.


Keywords
handmademapper, dependencyinjection, ioc, microsoft, aspnetcore, efcore, linq-expressions, map-dtos
License
MIT
Install
Install-Package NotSoAutoMapper.Extensions.Ioc.DependencyInjection -Version 3.0.0-preview1

Documentation

NotSoAutoMapper

A library to map your DTOs with reusable expressions.

Build Status

  • NuGet packages :

    • NotSoAutoMapper
      Nuget
    • NotSoAutoMapper.Extensions.Ioc.DependencyInjection: support for MS DI
      Nuget
    • NotSoAutoMapper.Extensions.Ioc.DryIoc: support for DryIoc
      Nuget
  • Documentation

Showcase

var catDtoMapper = new Mapper<Cat,CatDto>(x => new CatDto
{
    Id = x.Id,
    Name = x.Name,
    CutenessLevel = x.CutenessLevel
});
var personDtoMapper = new Mapper<Person, PersonDto>(x => new PersonDto
{
    Id = x.Id,
    FirstName = x.FirstName,
    LastName = x.LastName,
    Cat = x.Cat.MapWith(catDtoMapper) // Use the catDtoMapper
});

PersonDto personDto = personDtoMapper.Map(somePerson); // personDto.Cat is a CatDto!
Console.WriteLine($"{personDto.FirstName} has a cute cat named {personDto.Cat.Name}");
// >>> James has a cute cat named Felix