Hi there,
I wrote a general query to filter for different columns of the same Entity. Here's what I came up with:
public static ContactingEntity GetContactingEntity(Func<ContactingEntity, bool> filter) {
using (var adapter = new DataAccessAdapter()) {
var metaData = new LinqMetaData(adapter);
var q = (from t in metaData.Contacting
where filter(t)
select t).WithPath(_ContactingPrefetch);
foreach (var te in q) {
return te;
}
}
return null;
}
And two methods that actually provide the filtering:
public static ContactingEntity GetContactingEntityByLogin(string login) {
return GetContactingEntity(o => o.Login.Equals(login));
}
public static ContactingEntity GetContactingEntity(int contactingId) {
return GetContactingEntity(o => o.Id.Equals(contactingId));
}
I'm getting an exception:
SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryConstructionException: The binary expression '(Invoke(value(System.Func`2[dgoContentPortal.EntityClasses.ContactingEntity,System.Boolean]),[507]) = True)' can't be converted to a predicate expression.
Is it possible to provide filtering that way? Do I have to use Function Mapping?
Regards,
André