Entity Framework 6 does not recognize mapped function in database model
<p>I have a problem with Entity Developer and model defined function. Ealier I was mapping functions as a stored procedures because Entity Developer has no support for database functions as it goes. I was using solution mentioned in this <a href="http://forums.devart.com/viewtopic.php?t=17083" rel="nofollow">topic from devart forum</a>. But it has no use for me now, because I can't use it in <code>Linq</code> query as a part of bigger select statement on entity.</p>

<p>I am trying to add function like <a href="http://blog.devart.com/model-defined-functions-in-entity-developer.html?_ga=1.193775533.1888614147.1472728891" rel="nofollow">this</a> and make it the way it is mentioned <a href="http://forums.devart.com/viewtopic.php?f=32&amp;t=31557" rel="nofollow">here</a>. But i am getting this exception </p>

<blockquote>
  <p>Additional information: LINQ to Entities does not recognize the method 'System.Nullable<code>1[System.Int32] EwBlobIleWyst(System.String, System.Nullable</code>1[System.Int32], System.String, System.Nullable`1[System.Int32])' method, and this method cannot be translated into a store expression.</p>
</blockquote>

<p>In ssdl file function is generated like this:</p>

<pre><code>&lt;Function Name="EW_BLOB_ILE_WYST" IsComposable="true" ReturnType="decimal" BuiltIn="false" Aggregate="false" NiladicFunction="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="EWID4" StoreFunctionName="EW_BLOB_ILE_WYST"&gt;
&lt;Parameter Name="OWNER" Type="VARCHAR2" Mode="In" /&gt;
&lt;Parameter Name="OWNER_ID" Type="decimal" Mode="In" /&gt;
&lt;Parameter Name="RODZ_DOK_IDS" Type="VARCHAR2" Mode="In" /&gt;
&lt;Parameter Name="LICZ_PUSTE" Type="decimal" Mode="In" /&gt;
</code></pre>

<p></p>

<p>In csdl file it is like this :</p>

<pre><code>&lt;Function Name="EwBlobIleWyst" ReturnType="Collection(Int32)" ed:Guid="f544518f-1cdd-484c-92b4-73b61491dc54"&gt;
&lt;Parameter Name="OWNER" Type="String" /&gt;
&lt;Parameter Name="OWNER_ID" Type="Int32" /&gt;
&lt;Parameter Name="RODZ_DOK_DS" Type="String" /&gt;
&lt;Parameter Name="LICZ_PUSTE" Type="Int32" /&gt;
&lt;DefiningExpression&gt;SELECT EWID4.EW_BLOB_ILE_WYST(:OWNER, :OWNER_ID, :RODZ_DOK_IDS, :LICZ_PUSTE) FROM KDOK_WSK&lt;/DefiningExpression&gt;
</code></pre>

<p></p>

<p>And my implementation looks like this : </p>

<pre><code>    [EdmFunction(@"Ewid4", @"EwBlobIleWyst")]
    public virtual global::System.Nullable&lt;int&gt; EwBlobIleWyst(string OWNER, global::System.Nullable&lt;int&gt; OWNER_ID, string RODZ_DOK_IDS, global::System.Nullable&lt;int&gt; LICZ_PUSTE)
    {
        throw new NotSupportedException();
    }
</code></pre>

<p>This code is inside partial context class.
And I am using it in this way :</p>

<pre><code>DokPow = ((Ewid4)context).EwBlobIleWyst("smth", 1, null, 0)
</code></pre>

<p>This snippet is inside select of queryable using Linq</p>