Hello,
seems that I still run into some troubles when using where clause instead of filter in join.
So still searching for a way to extend filter (OnClause) in dynamic relation.
I have such code:
var relation = queryParameters.RelationsToUse[i] as IDynamicRelation;
if (relation.OnClause != null)
{
relation = new CustomDynamicRelation(
inheritanceInfoProvider,
relation.JoinType,
relation.AliasLeftOperand, relation.AliasRightOperand,
relation.OnClause,
relation.LeftOperand,
relation.RightOperand);
queryParameters.RelationsToUse[i] = relation
}
and I have such class
private class CustomDynamicRelation : DynamicRelationBase
{
private readonly IInheritanceInfoProvider _inheritanceInfoProvider;
public CustomDynamicRelation(IInheritanceInfoProvider inheritanceInfoProvider, JoinHint joinType, string aliasLeftOperand, string aliasRightOperand, IPredicate onClause, object leftOperand, object rightOperand)
{
_inheritanceInfoProvider = inheritanceInfoProvider;
InitClass(joinType, aliasLeftOperand, aliasRightOperand, onClause, leftOperand, rightOperand);
}
protected override IInheritanceInfoProvider GetInheritanceProvider()
{
return _inheritanceInfoProvider;
}
}
However - I get an error:
SD.LLBLGen.Pro.ORMSupportClasses.ORMRelationException: Relation at index 4 doesn't contain an entity already added to the FROM clause. Bad alias?
So my question - what I am doing wrong. Basically I just recreated same dynamic relation (next step to change OnClause), using same fields, but seems that LLBL does not like this.
Any ideas?
Version (using adapter scenario):
SD.LLBLGen.Pro.DQE.SqlServer.4.2.20150323
SD.LLBLGen.Pro.ORMSupportClasses.4.2.20150323
regards
Mantas