title: Entity Framework stored procedure return type changed
body: <p>I mostly update my data model by deleting my <code>.EDMX</code> file and adding it again, just to make sure I get everything I have in the database.</p>
  
  <p>I ran into a strange issue, where one of my stored procedure return types has been changed after deleting and re-adding the <code>.EDMX</code>. The stored procedure code remains unchanged, and can be found below. I am not sure what wrong I did?</p>
  
  <p>SQL Server stored procedure (never changed):</p>
  
  <pre><code>SET ANSI_NULLS ON
  GO
  SET QUOTED_IDENTIFIER ON
  GO
  
  ALTER procedure [dbo].[usp_SearchOrders]
        @orderid int = null, @statusid int = null, 
        @startdate datetime = null, @enddate datetime = null,
        @customername varchar(30) = null, @customeraddress varchar(30) = null
  AS
       SELECT 
           O.OrderID Order_ID, O.OrderDate,
           OrderTotal = (SELECT SUM(od.UnitPrice - (od.UnitPrice * od.Discount)) 
                         FROM [Order Details] od 
                         WHERE od.OrderID = O.OrderID),
           Discount = (SELECT SUM(od.UnitPrice * od.Discount) 
                       FROM [Order Details] od 
                       WHERE od.OrderID = O.OrderID),
           CC.Email1, CC.Phone,
           Status = (SELECT OS.OrderStatusName 
                     FROM OrderStatus OS 
                     WHERE OS.OrderStatusID = O.OrderStatusID),
           OrderType = (SELECT OT.OrderTypeName 
                        FROM OrderType OT 
                        WHERE OT.OrderTypeID = O.OrderTypeID)
       FROM
           Orders O 
       JOIN 
           Customers C ON O.CustomerID = C.CustomerID
       JOIN 
           CustomersContactDetails CC ON C.CustomerID = CC.CustomerID
       WHERE 
           (O.OrderID = @orderid OR @orderid IS NULL)
           AND (O.OrderStatusID = @statusid OR @statusid IS NULL)
           AND (O.OrderDate &gt;= @startdate OR @startdate IS NULL)
           AND (O.OrderDate &lt;= @enddate OR @enddate IS NULL)
           AND (C.CustomerName LIKE @customername OR @customername IS NULL)
           AND (CC.Address LIKE @customeraddress OR @customeraddress IS NULL)
           AND (CC.City LIKE @customeraddress OR @customeraddress IS NULL)
  </code></pre>
  
  <p>C# code: <code>_dbContext.usp_SearchOrders(1,1,DateTime.Now, DateTime.Now.AddDays(1),'Hitin','BH');</code></p>
  
  <p>Before update return type: <code>usp_SearchOrders_Result</code></p>
  
  <p>After re-adding return type: <code>int</code></p>
  
  <p>I never made any complex type or did any mapping, the class <code>usp_SearchOrders_Result</code> was created on it own.</p>
  
  <p>What could be the possible reason behind this issue?</p>