Currently DbDataAdapter.SelectQuery can perform simple column-to-property POCO mapping.
In some cases single query result should be mapped to more complex structure with nested objects.
This is possible to achieve with custom mapping handler, smth like this:
DbDataAdapter dbAdapter;
var myModel = dbAdapter.Select(...)
.Map( (context) => {
var res = new MyModel();
context.MapTo(res); // populate properties of main model
context.MapTo(res.Submodel); // populate properties of submodel
return res;
} )
.Single<MyModel>();
Also context.MapTo should have an overload that will accept column-to-property map (Dictionary<string,string>).
The text was updated successfully, but these errors were encountered:
Currently DbDataAdapter.SelectQuery can perform simple column-to-property POCO mapping.
In some cases single query result should be mapped to more complex structure with nested objects.
This is possible to achieve with custom mapping handler, smth like this:
Also
context.MapTo
should have an overload that will accept column-to-property map (Dictionary<string,string>
).The text was updated successfully, but these errors were encountered: