简体   繁体   中英

IMultipleResults: how do I deal with multiple result sets from a stored proc when they don't map to types?

This post on SO answers most of the questions I have (much thanks to Pure.Krome for the thorough response) about how to build a query that returns multiple results. However, in the case that I'm working with my tables that are coming back are sort of dependent on how the proc behaves. Can't change the proc. The results that are coming back are a set of datatables that don't map to types at all (for example, the first table is a mish mash of parts of the Customers table and the Orders table, the second table, if present, will be debugging output, then there might be a third table and so on).

Do I have to do this as a dataset/datadapter etc? Or is this possible with LINQ?

LINQ is an ORM (albeit a fairly simple one), with the "O" being (importantly) "object". If you can't predict the layout of the object returned in each grid, then it isn't a good fit for ORM.

Personally I wouldn't jump from LINQ to DataTable (but maybe I'm just biased against DataTable ;-p) - I would use SqlCommand.ExecuteReader and do my own object (etc) mapping. But maybe it might save time to just use a DataSet ... YMMV etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM