Skip to content

Latest commit

 

History

History
35 lines (25 loc) · 1.56 KB

README.md

File metadata and controls

35 lines (25 loc) · 1.56 KB

AutoMapper

The data extensions to AutoMapper, IDataReader support

CI NuGet MyGet (dev)

Install via initialization:
var mapper = new Mapper(cfg => {
   cfg.AddDataReaderMapping();
   cfg.CreateMap<IDataRecord, MyDto>();
   cfg.CreateMap<IDataRecord, MyOtherDto>();
   // Other config
});

// or with the AutoMapper.Extensions.Microsoft.DependencyInjection package:

services.AddAutoMapper(typeof(Startup), cfg => {
	cfg.AddDataReaderMapping();
});

You will need to configure maps for each IDataRecord DTO mapping.

Using Profile:

There are several ways to configure mapping with an instance of Profile:

  • Create an instance of Profile, call the Profile.AddDataRecordMember extension method on it, and add it to the configuration.
  • Call AddMemberConfiguration().AddMember<DataRecordMemberConfiguration>() on the instance.
  • Call the IMapperConfigurationExpression.AddDataReaderProfile extension method.