I've been searching Stackoverflow for the best solution to the problem to this problem:
"The specified type member 'Income' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported."
I want to avoid copying the whole data set into memory to manipulate it. The code I use right now looks like this, where I want to avoid using AsEnumerable (copying it to local memory).
from refs in entities.ReferralSet
where refs.ReferralSince >= fromDate
&& (refs.ReferralTill ?? DateTime.Today) <= toDate
select refs).AsEnumerable().Sum(o => o.Income
The Income code used:
public double Income
{
get
{
MembershipType type = /* bla bla bla */
return Click.Count * CalculateBAL.ReferralEarningClick(type);
}
}
I know that I can't use properties that are not mapped to a database columns. So what is the best way to work around this problem without copying the whole dataset into memory?
Feel free to ask if I'm missing any information or you need further explanation.
Thanks in advance