title: How to query a stored procedure object with Linq
body: <p>Say I got this situation: I have to filter one of my entities with data which I get from an stored procedure:</p>
  
  <pre><code>var results = from c in db.Customer
  join p in db.GetSPResults() on c.Id equals p.Id
  select c;
  </code></pre>
  
  <p>on my Context class I got this:</p>
  
  <pre><code>public ObjectResult&lt;Example&gt; GetSPResults()
  {
      return (this as IObjectContextAdapter).ObjectContext.ExecuteFunction&lt;Example&gt;("Proc_Example");
  }
  </code></pre>
  
  <p>So far I run into 2 problems:</p>
  
  <ol>
  <li><p>I get an InvalidOperationException when code strikes the ExcecuteFunction line: </p>
  
  <blockquote>
    <p><em>The FunctionImport 'xxx' could not be found in the container 'xxx'</em>.</p>
  </blockquote></li>
  <li><p>Assuming you guys can help me to solve that problem, would it be possible to query that way? Using those stored procedure results like a context entity? I think EF won't allow that cause it's not an entity, nor a "Constant Value".</p></li>
  </ol>
  
  <p>I'm using EF 4.3.</p>