title: More than 2 result sets in stored procedure
body: <p>I have followed the guidance for returning more than 1 resultset in a stored procedure with Entity Framework. Found here:</p>
  
  <ul>
  <li><a href="https://msdn.microsoft.com/en-us/data/jj691402.aspx?f=255&amp;MSPPError=-2147217396" rel="nofollow">https://msdn.microsoft.com/en-us/data/jj691402.aspx?f=255&amp;MSPPError=-2147217396</a></li>
  <li><a href="http://www.binaryintellect.net/articles/30738a7c-5176-4333-aa83-98eab8548da5.aspx" rel="nofollow">http://www.binaryintellect.net/articles/30738a7c-5176-4333-aa83-98eab8548da5.aspx</a></li>
  <li><a href="http://www.codeproject.com/Articles/675933/Returning-Multiple-Result-Sets-from-an-Entity-Fram?msg=5026933#xx5026933xx" rel="nofollow">http://www.codeproject.com/Articles/675933/Returning-Multiple-Result-Sets-from-an-Entity-Fram?msg=5026933#xx5026933xx</a></li>
  </ul>
  
  <p>However if a 3rd resultset is returned, after the client code calls the <code>GetNextResult&lt;T&gt;</code> there is an error:</p>
  
  <blockquote>
    <p>The type parameter 'db.GetShippingItems' in ExecuteFunction is incompatible with the type 'db.GetProductDetails' returned by the function.</p>
  </blockquote>
  
  <p><code>GetProductDetails</code> is the 2nd return type. The first is <code>GetProduct</code>. I added a 3rd ResultMapping to the <code>FunctionImportMapping</code> element in the <code>.edmx</code> file.</p>
  
  <p>The <code>FunctionImport</code> is as follows:</p>
  
  <pre><code>&lt;FunctionImport Name="GetProduct"&gt;
     &lt;ReturnType Type="Collection(db.GetProduct)" /&gt;
     &lt;ReturnType Type="Collection(db.GetProductDetails)" /&gt;
     &lt;ReturnType Type="Collection(db.GetProductShippingItems)" /&gt;
     &lt;Parameter Name="ProgId" Mode="In" Type="Int32" /&gt;
  &lt;/FunctionImport&gt;
  </code></pre>