title: Use a stored procedure in entity framework
body: <p>I have a model-first EF model. I just imported the first stored procedure: <code>cpas_POIDVendorProjectDate</code></p>
  
  <p>I imported it as a function. It has three input parameters: <code>@ProjectID(int)</code>, <code>@VendorID(int)</code>, and <code>@Workdate(datetime)</code>, and returns <code>@POID(int)</code>.</p>
  
  <p>Here's the SQL code: </p>
  
  <pre><code> CREATE PROCEDURE [dbo].[cpas_POIDVendorProjectDate]
      @VendorID int,
      @ProjectID int,
      @WorkDate datetime,
      @PO_ID int OUTPUT
   AS
   BEGIN
      SET NOCOUNT ON;
  
      DECLARE @RowCount int;
  
         SELECT @PO_ID = ID FROM tblPO WHERE 
          VendorID = @VendorID
          AND ExpirationDate &gt;= @WorkDate
          AND (ProjectID IS NULL OR ProjectID = @ProjectID)
          AND CapitalExpense = (
            SELECT CapitalExpense FROM tblProjects WHERE ID=@ProjectID)
          AND GroupCode in (1,3,5);
  
       SET @RowCount = @@RowCount;
  
       IF (@RowCount != 1)
         SET @PO_ID = -1*@RowCount;
  
  END
  </code></pre>
  
  <p>I called it in my c# program as follows:</p>
  
  <pre><code>context.cpas_POIDVendorProjectDate(
      currVendorID, currProjectID, currWorkDate, currPOID);
  </code></pre>
  
  <p>Intellisense says my use of "context" is wrong...It's a "variable", and I'm using it as a "method".</p>
  
  <p>In addition, <code>currPOID</code> is rejected because it's looking for a <code>system.data.objects.OjbectParameter</code>, not an <code>int</code>. Intellisense is happy with the function name and other parameters (strangely...)</p>
  
  <p>What am I doing wrong here?</p>