I am having to return several record sets from SQL Server to constructs a C# object. While EF doesn’t currently support (possibly the beta version) returning complex objects like this I am having to resort to returning a DataSet using ADO.NET to retrieve the data before transforming it into a pleasant C# representation, see below.
SELECT * FROM ...
exec dbo.usp_SP1 @ProductID,@CatalogName
exec dbo.usp_SP2 @ProductID,@CatalogName
Its always better to make fewer database calls however due to how this query is being executed would making several requests for each DataSet be that much worst?
One database roundtrip is always better that three (or two).
Your code could be clean even with this set of queries. You just have to call
DataTable.Loadthree times, in succession, to load all three results sets from theDbDataReader.So yes, I recommend one bigger query and a single
DataSetfor all result sets.