Search code examples
datatableautomapperenterprise-libraryidatareadertable-valued-parameters

C#, AutoMapper, HOWTO: Map List to DataTable


Due to working with enterprise library data blocking to execute stored procedures with Table valued params (TVP).

I want to be able to map a list => DataTable before the stored procedure execution.

The Problem is that I need to perform this conversion with AutoMapper and not manually.

I wish to do something like this:

Mapper.CreateMap<MyObject, IDataReader>()
    .ForMember
    ...
    ...

Solution

  • It sounds like what you need is something like Dapper instead of AutoMapper:

    https://github.com/StackExchange/dapper-dot-net