I have got this exception in the last line of my code:
Unable to create a constant value of type ‘System.Linq.EnumerableQuery`1’. Only primitive types (‘such as Int32, String, and Guid’) are supported in this context.
My Code:
using (GharardadhaEntities dal = new GharardadhaEntities())
{
IQueryable<TBL_Gharardad> Gharardadha =
from record in dal.TBL_Gharardad
join shenase in Query on record.PK_Shenase equals shenase
select record;
var q = (from record in dal.TBL_MabalegheDariaftieMahane
where record.TBL_Gharardad == Gharardadha.First()
select record);
ulong v = (ulong)Gharardadha.First().MablagheDariaftiKol;// I have got the error on this statement
}
What is wrong with my code?
I believe that the problem is
Query. The exception says that you cannot passEnumerableQueryto Linq-to-entities. IfQueryisIEnumerabletry to rewrite first query as: