The error suggests you're using an older build of the linq provider/ormsupportclasses, please use the latest build available in the customer area.
Also, please have a look at the predicatebuilder class in this thread:
http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=14224
which I think gives you another way to do this.
Also, I think this is a different, better way to do this:
public IQueryble<DocumentEntity> GetDocuments(LinqMetaData metaData)
{
return from d in metaData.Documents select d;
}
public IQueryable<DocumentEntity> FilterOne(IQueryable<DocumentEntity> toFilter)
{
return toFilter.Any(d=>d.MetaDataInDocument.MetaData.Any(m=>m.Name=="Date" && m.Date< DateTime.Now.AddHours(-10.0)));
}
etc.
public Main()
{
LinqMetaData metaData = new LinqMetaData();
var q = GetDocuments(metaData);
q = FilterOne(q);
//...
var q = (from d in q
select d.ID).Distinct();
//...
}
This too requires a recent build as nested Any clauses could cause problems in edge cases, so a recent build which fixes this bug is required. Please let us know if this works or not and if not (i.e crashes with exceptions) please post the FULL stacktrace and the query produced (through DQE tracing, see 'troubleshooting and debugging' in manual).