you should alias the table in the subquery.
Please see this thread:
http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=3401
So your code will become:
[code]
IEntityField2 setField = EntityFieldFactory.Create(BlockVersionFieldIndex.Version);
setField.AggregateFunctionToApply = AggregateFunction.Max;
setField.ObjectAlias = "VC";
// bucket is not necessary here,
//RelationPredicateBucket setFilter = new RelationPredicateBucket();
IPredicate setFilter = PredicateFactory.CompareValue(BlockVersionFieldIndex.Name, ComparisonOperator.Equal, @"""GIS"".""BLOCK_VERSION"".""NAME""", "BV", "VC");
RelationPredicateBucket filter = new RelationPredicateBucket();
filter.PredicateExpression.Add(new FieldCompareSetPredicate(
EntityFieldFactory.Create(BlockVersionFieldIndex.Version), null,
setField, null,
SetOperator.Equal,
new PredicateExpression(setFilter),
null,
string.Empty,
0,
null,
false,
null));
EntityCollection blocks = new EntityCollection(new BlockVersionEntityFactory());
mAdapter.FetchEntityCollection(blocks, filter, 0);
-> 2 times an alias is specified, once for the setfield and once in the comparison for the setfilter. I've removed the setfilterbucket, as that's not necessary here, and I've changed -1 to 0, as 0 is defined as 'give all rows'.
* First of all, i would like to commend you and everyone responsible for LLBLGen on a great developer tool. The company I am currently working for plans to buy LLBLGen licenses ASAP ( My recommendation of course :] ).