问题
I have a large hand tuned SQL query that returns a flat data table with many (>25) columns.
Currently, I manually convert that to a .NET object with three levels of nesting (i.e. an object which contains (among other properties) a list of further objects which contains (among other properties) a list of further objects.
Is there anything with the ease of something like AutoMapper which can convert a DataTable into a target .NET object, even if its nested?
回答1:
I am the original poster of this question.
It turns out that I was asking the wrong question: I should have been asking how to easily perform fast queries which map into a complex arrangement of POCOs.
I have posted the solution that worked perfectly for me, see How do I write one to many query in Dapper.Net? and the answer that references Dapper + Slapper.Automapper.
来源:https://stackoverflow.com/questions/30031223/is-there-a-way-to-easily-convert-a-flat-datatable-to-a-nested-net-object