JoinConditionExpression represents the data source defined by a member access in the from part of a linq expression.
Inheritance: Remotion.Linq.Clauses.Expressions.ExtensionExpression
    public void ToString_Resolved ()
    {
      var resolvedJoinInfo = new ResolvedJoinInfo (new ResolvedSimpleTableInfo (typeof (Cook), "CookTable", "c"), Expression.Constant (true));
      var expression = new JoinConditionExpression (new SqlJoinedTable (resolvedJoinInfo, JoinSemantics.Left));

      var result = expression.ToString();

      Assert.That (result, Is.EqualTo ("CONDITION(LEFT JOIN [CookTable] [c] ON True)"));
    }
    public virtual Expression VisitJoinConditionExpression (JoinConditionExpression expression)
    {
      ArgumentUtility.CheckNotNull ("expression", expression);

      var resolvedLeftJoinInfo = expression.JoinedTable.JoinInfo.GetResolvedJoinInfo();
      return VisitExpression (resolvedLeftJoinInfo.JoinCondition);
    }
    public void VisitMemberExpression ()
    {
      var memberExpression = Expression.MakeMemberAccess (Expression.Constant (new Cook()), typeof (Cook).GetProperty ("IllnessDays"));
      var result = SqlPreparationFromExpressionVisitor.AnalyzeFromExpression (
          memberExpression, _stageMock, _generator, _methodCallTransformerProvider, _context, info => new SqlTable (info, JoinSemantics.Inner));

      Assert.That (result.SqlTable, Is.TypeOf (typeof (SqlTable)));
      Assert.That (((SqlTable) result.SqlTable).TableInfo, Is.TypeOf (typeof (SqlJoinedTable)));
      Assert.That (((SqlJoinedTable) ((SqlTable) result.SqlTable).TableInfo).JoinInfo, Is.TypeOf (typeof (UnresolvedCollectionJoinInfo)));
      Assert.That (
          ((UnresolvedCollectionJoinInfo) ((SqlJoinedTable) ((SqlTable) result.SqlTable).TableInfo).JoinInfo).SourceExpression,
          Is.EqualTo (memberExpression.Expression));
      Assert.That (
          ((UnresolvedCollectionJoinInfo) ((SqlJoinedTable) ((SqlTable) result.SqlTable).TableInfo).JoinInfo).MemberInfo,
          Is.EqualTo (memberExpression.Member));
      var expectedWherecondition = new JoinConditionExpression (((SqlJoinedTable) ((SqlTable) result.SqlTable).TableInfo));
      SqlExpressionTreeComparer.CheckAreEqualTrees (expectedWherecondition, result.WhereCondition);
    }
    public void VisitJoinConditionExpression ()
    {
      var resolvedTableInfo = new ResolvedSimpleTableInfo (typeof (Cook), "CookTable", "c");
      var leftKey = new SqlColumnDefinitionExpression (typeof (Cook), "c", "ID", false);
      var rightKey = new SqlColumnDefinitionExpression (typeof (Cook), "a", "FK", false);
      var joinInfo = new ResolvedJoinInfo (resolvedTableInfo, Expression.Equal (leftKey, rightKey));
      var sqlTable = new SqlJoinedTable (joinInfo, JoinSemantics.Left);
      var joinConditionExpression = new JoinConditionExpression (sqlTable);

      _entityIdentityResolverMock
          .Expect (
              mock => mock.ResolvePotentialEntityComparison (
                  Arg<BinaryExpression>.Matches (b => b.Left == leftKey && b.Right == rightKey)))
          .Return (null)
          .WhenCalled (mi => mi.ReturnValue = mi.Arguments[0]);
      _compoundComparisonSplitterMock
          .Expect (
              mock => mock.SplitPotentialCompoundComparison (
                  Arg<BinaryExpression>.Matches (b => b.Left == leftKey && b.Right == rightKey)))
          .Return (null)
          .WhenCalled (mi => mi.ReturnValue = mi.Arguments[0]);

      var result = _visitor.VisitExpression (joinConditionExpression);

      _entityIdentityResolverMock.VerifyAllExpectations();
      _compoundComparisonSplitterMock.VerifyAllExpectations();

      var expectedExpression = Expression.Equal (leftKey, rightKey);
      SqlExpressionTreeComparer.CheckAreEqualTrees (expectedExpression, result);
    }
 public void SetUp ()
 {
   var sqlTable = SqlStatementModelObjectMother.CreateSqlJoinedTable_WithUnresolvedJoinInfo();
   _expression = new JoinConditionExpression (sqlTable);
 }