I'm using nHibernate 3.2.0.4000. I wrote this query using nHibernate.Linq
var entities = (from t in this.Session.Query<Task>()
where NotIn(t, role.Tasks)
select t).ToList();
Here's the definition of the method NotIn()
private bool NotIn(Task t, IEnumerable<TaskDto> tasks)
{
foreach (var task in tasks)
{
if (t.Name == task.Name) return false;
}
return true;
}
When I'm executing this query, I've got an NotSupportedException
error:
Boolean NotIn(Probel.NDoctor.Domain.DAL.Entities.Task, System.Collections.Generic.IEnumerable`1[Probel.NDoctor.Domain.DTO.Objects.TaskDto])
I found a non Linq solution that is less readable but I still want to, at least, understand why it is impossible to build a Linq query like this.
Thank you in advance for your help!