I'd have to post too much code to put our FetchTypedView call into context. What I mean is that I think it would just lead to a lot more questions that would really be about explaining helper classes we've written for LLBLGen rather than revealing anything particularly helpful to the issue at hand.
It's actually easier to post the code I used to overcome the problem described above.
I hope to get a fix to the actual library but for now I've defined the include file for the DataAccessAdapter and added the following code. The code below effectively replaces the definition of FetchTypedView in the DataAccessAdapterBase class. This code fixes the problem described in my original post.
public override void FetchTypedView(IEntityFields2 fieldCollectionToFetch, DataTable dataTableToFill, IRelationPredicateBucket filterBucket, int maxNumberOfItemsToReturn, ISortExpression sortClauses, bool allowDuplicates, IGroupByCollection groupByClause, int pageNumber, int pageSize)
{
TraceHelper.WriteLineIf(TraceHelper.PersistenceExecutionSwitch.TraceInfo, "DataAccessAdapterBase.FetchTypedView(9)", "Method Enter");
// #### This is the way it is currently coded in the ORM support library
// IFieldPersistenceInfo[] persistenceInfoObjects = this.GetFieldPersistenceInfos(fieldCollectionToFetch[0].ContainingObjectName);
for (int i = 0; i < fieldCollectionToFetch.Count; i++)
{
this.InsertPersistenceInfoObjects(fieldCollectionToFetch[i]);
}
// #### This is the code I use to fix the issue ####
// #### START
IFieldPersistenceInfo[] persistenceInfoObjects = new FieldPersistenceInfo[fieldCollectionToFetch.Count];
for (int i = 0; i < fieldCollectionToFetch.Count; i++)
{
persistenceInfoObjects[i] = this.GetFieldPersistenceInfo(fieldCollectionToFetch[i]);
}
// #### FINISH
bool relationsPresent = false;
IPredicateExpression expressionToPass = null;
this.InterpretFilterBucketLocal(filterBucket, ref relationsPresent, ref expressionToPass);
this.InsertPersistenceInfoObjects(sortClauses);
this.InsertPersistenceInfoObjects(groupByClause);
IRetrievalQuery selectQuery = null;
if (relationsPresent)
{
selectQuery = this.CreateSelectDQ(fieldCollectionToFetch, persistenceInfoObjects, expressionToPass, (long) maxNumberOfItemsToReturn, sortClauses, filterBucket.Relations, allowDuplicates, groupByClause, pageNumber, pageSize);
}
else
{
selectQuery = this.CreateSelectDQ(fieldCollectionToFetch, persistenceInfoObjects, expressionToPass, (long) maxNumberOfItemsToReturn, sortClauses, null, allowDuplicates, groupByClause, pageNumber, pageSize);
}
try
{
this.OnFetchTypedView(selectQuery, fieldCollectionToFetch, dataTableToFill);
this.ExecuteMultiRowDataTableRetrievalQuery(selectQuery, this.CreateNewPhysicalDataAdapter(), dataTableToFill, persistenceInfoObjects);
this.OnFetchTypedViewComplete(selectQuery, fieldCollectionToFetch, dataTableToFill);
}
finally
{
selectQuery.Dispose();
}
TraceHelper.WriteLineIf(TraceHelper.PersistenceExecutionSwitch.TraceInfo, "DataAccessAdapterBase.FetchTypedView(9)", "Method Exit");
}
// #### Had to define this renamed copy of InterpretFilterBucket b/c it's
// #### used by FetchTypedView but it's inaccesible to inheritors of
// #### DataAccessAdaptorBase.
private void InterpretFilterBucketLocal(IRelationPredicateBucket filterBucket, ref bool relationsPresent, ref IPredicateExpression expressionToPass)
{
relationsPresent = false;
expressionToPass = null;
if (filterBucket != null)
{
if (((RelationCollection) filterBucket.Relations).Count > 0)
{
this.InsertPersistenceInfoObjects(filterBucket.Relations);
relationsPresent = true;
}
if ((filterBucket.PredicateExpression != null) && (filterBucket.PredicateExpression.Count > 0))
{
expressionToPass = filterBucket.PredicateExpression;
this.InsertPersistenceInfoObjects(expressionToPass);
}
}
}