I have got a following query:
Expression<Func<Contact, bool>> c2 = (col => col.CompanyContacts.AsQueryable().Any(p => p.Company.CompanyName.Contains("some_name")));
ITypedEntityQuery query = EntityQuery<Contact>.Create(typeof(Contact), Manager).Cast<Contact>().Where(c2).OrderBySelector(selector).Skip(skip).Take(take);
That works perfectly fine. Unfortunatelly when I try to split the first expression into two like this:
var exp1 = (Expression<Func<CompanyContact, bool>>)(p => p.Company.CompanyName.Contains("some_name"));
Expression<Func<Contact, bool>> c2 = (col => col.CompanyContacts.AsQueryable().Any(exp1));
I got a nasty serialization error:
Type 'System.Linq.Expressions.Expression`1[System.Func`2[DomainModel.CompanyContact,System.Boolean]]' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. If the type is a collection, consider marking it with the CollectionDataContractAttribute. See the Microsoft .NET Framework documentation for other supported types.
The point of splitting the query is simple - I want to generate the inner part from IPredicateDescription.
Thanks in advance.