title: Calling a custom scalar DB function inside a LINQ to Entities query?
body: <p>Is there a way I can call a custom scalar DB function as part of my LINQ to Entities query?  The only thing I can find on the web about this is this page:</p>
  
  <p><a href="https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/ef/language-reference/how-to-call-custom-database-functions" rel="noreferrer">https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/ef/language-reference/how-to-call-custom-database-functions</a></p>
  
  <p>However the instructions given here seem to assume you are using a DB-first approach and talk about modifying the <code>.edmx</code> file.  What about if you're using a code-first approach?  I want to be able to write something like this:</p>
  
  <pre><code>var result = await (
      from itm in _itemDataContext.Items
      where
          itm.QryGroup1 == "Y" &amp;&amp;
          _itemDataContext.Dbo_MyCustomScalarIntFn(itm.QryGroup2) &gt; 0
  ).ToArrayAsync();
  </code></pre>