title: Retrieve multiple relational data object from stored procedure
body: <p>I tried to get multiple datatable from a stored procedure in my ASP.NET Core MVC app side.</p>
  <p>But I want to get three datatables from SQL Server but I couldn't. I tried to write API layer from this query with <code>FromSqlInterpolated</code>. But data retrieved is always null, how can create this retrieve object classes? I tried to use three lists in a single <code>sp_myPersonelSalesOrderInfosList</code> class. But lists return or mapped null.</p>
  <p>How can I retrieve this SQL command to object ?</p>
  <pre><code>SET ANSI_NULLS ON
  GO
  
  SET QUOTED_IDENTIFIER ON
  GO
  
  CREATE PROCEDURE [dbo].[sp_myPersonalSalesOrderInfosList] 
       @OrderNumber NVARCHAR(50)
  AS
  BEGIN
      SET NOCOUNT ON;
  
      --Dt 1 
      SELECT TOP 1 
          OrderNumber,
          PLAN_AMOUNT Planamount,
          ID MppId
      FROM 
          PRODUCT_PLAN
      WHERE 
          OrderNumber LIKE '%' + @OrderNumber + ''
          AND isDeleted = 0;
  
      --dt2 
      SELECT 
          p.OrderNumber,  
          p.PLAN_AMOUNT Planamount,
          p.ID MppId,
          p.ProcessNo OpNo,
          m.MACHINE_CODE + '-' + m.MACHINE_NAME MachineInfo
      FROM
          PRODUCT_PLAN p
      JOIN 
          MACHINES m ON m.ID = p.MACHINE_ID
      WHERE 
          OrderNumber LIKE '%' + @OrderNumber + ''
          AND isDeleted = 0;
  
      --dt 3 
      SELECT 
          p.ID MppId,
          d.ID MppdId,
          d.PRODUCTION_AMOUNT ProductAmount
      FROM 
          PRODUCT_PLAN_DETAIL d
      JOIN 
          PRODUCT_PLAN p ON p.ID = d.MPP_ID
      WHERE 
          OrderNumber LIKE '%' + @OrderNumber + ''
          AND p.isDeleted = 0
          AND d.PRODUCTION_AMOUNT &gt; 0;
  END
  </code></pre>