You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Custom object mapper for DbDataAdapter.Select result #28
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>).
Activity
Custom object mapper for DbDataAdapter.Select result #28
VitaliyMF commentedon Mar 3, 2017
Added DbDataAdapter.SelectQuery.SetMapper method that accepts custom mapping handler.
Shipped in 1.0.1