protected override void VisitTwoPropertiesComparison(TwoPropertiesConstraint node) { var leftTable = Query.From.FindTable(node.LeftPropertyOwner ?? node.LeftProperty.OwnerType); var rightTable = Query.From.FindTable(node.RightPropertyOwner ?? node.RightProperty.OwnerType); _whereResult = f.Constraint( leftTable.Column(node.LeftProperty), ConvertOperator(node.Operator), rightTable.Column(node.RightProperty) ); }
protected override void VisitTwoPropertiesComparison(TwoPropertiesConstraint node) { var leftTable = Query.From.FindTable(node.LeftPropertyOwner ?? node.LeftProperty.OwnerType); var rightTable = Query.From.FindTable(node.RightPropertyOwner ?? node.RightProperty.OwnerType); _whereResult = f.Constraint( leftTable.Column(node.LeftProperty), ConvertOperator(node.Operator), rightTable.Column(node.RightProperty) ); }
private void AddConstraint(PropertyCompareOperator op, IManagedProperty property, Type propertyOwner = null) { if (_pending == null) { throw new InvalidOperationException("查询构造出错:你必须先调用方法 Constrain。"); } //如果没有指定属性对应的实体类型,则使用当前仓库对应的实体来作为属性的拥有者。 var leftPropertyOwner = _pendingOwner; if (leftPropertyOwner == null) { leftPropertyOwner = _pending.OwnerType; if (_repo.EntityType.IsSubclassOf(leftPropertyOwner)) { leftPropertyOwner = _repo.EntityType; } } var constraint = new TwoPropertiesConstraint { Context = this, LeftProperty = _pending, LeftPropertyOwner = leftPropertyOwner, Operator = op, RightProperty = property, RightPropertyOwner = propertyOwner }; this.AddConstraint(constraint); _pending = null; _pendingOwner = null; }
protected virtual void VisitTwoPropertiesComparison(TwoPropertiesConstraint node) { }
protected virtual void VisitTwoPropertiesComparison(TwoPropertiesConstraint node) { }