예제 #1
0
        private void Join(GenericWhereEntity <TA> TA, GenericWhereEntity <TB> TB,
                          Expression <Func <TA, TB, bool> > conditionExpression, JoinModeEnum joinMode)
        {
            if (conditionExpression.Body == null)
            {
                throw new EntitySqlException("未指定连接条件!");
            }
            if (!(conditionExpression.Body is BinaryExpression) || !CheckJoinCondition(conditionExpression.Body))
            {
                throw new EntitySqlException("指定的连接条件无效!");
            }

            JoinMode                     = joinMode;
            MainEntity                   = TA;
            EntityToJoin                 = TB;
            _leftTableGuid               = TA.Guid;
            _rightTableGuid              = TB.Guid;
            _joinConditionExpression     = conditionExpression.Body;
            _joinConditionFirstParameter = conditionExpression.Parameters[0].Name;
        }
예제 #2
0
 public void LeftJoin(GenericWhereEntity <TA> TA, GenericWhereEntity <TB> TB,
                      Expression <Func <TA, TB, bool> > conditionExpression)
 {
     Join(TA, TB, conditionExpression, JoinModeEnum.LeftJoin);
 }