I have followed the guidance for returning more than 1 resultset in a stored procedure with Entity Framework. Found here:
However if a 3rd resultset is returned, after the client code calls the
GetNextResult<T> there is an error:
The type parameter 'db.GetShippingItems' in ExecuteFunction is incompatible with the type 'db.GetProductDetails' returned by the function.
GetProductDetails is the 2nd return type. The first is
GetProduct. I added a 3rd ResultMapping to the
FunctionImportMapping element in the
FunctionImport is as follows:
<FunctionImport Name="GetProduct"> <ReturnType Type="Collection(db.GetProduct)" /> <ReturnType Type="Collection(db.GetProductDetails)" /> <ReturnType Type="Collection(db.GetProductShippingItems)" /> <Parameter Name="ProgId" Mode="In" Type="Int32" /> </FunctionImport>
To get third resultset you need to use the GetNextResults() for the second resultset etc.
//Get second result set var products = results.GetNextResult<Product_SprocResult>(); categProd.Products.AddRange(products); //Get third result set var statuTypes = products.GetNextResult<StatusType_SprocResult>(); categProd.StatusTypes.AddRange(statuTypes);