示例#1
0
        private void CreateJoinExpressionForDefinedRelation(QueryBuildInfo buildInfo)
        {
            string    typeFromAlias = buildInfo.GetAlias(TypeFrom);
            IRelation relation      = processor.GetRelation(TypeFrom, TypeTo);

            if (relation == null)
            {
                relation = processor.GetRelation(TypeTo, TypeFrom);
            }

            if (relation != null)
            {
                Expr = JoinExpr.Build();
                ICollection <RelationColumnMapping> tableColumnMappings = relation.TableColumnMappings;
                int i = 0;
                foreach (RelationColumnMapping mapping in tableColumnMappings)
                {
                    if (i > 0)
                    {
                        Expr.And();
                    }
                    Expr.Field(TypeFrom, typeFromAlias, mapping.FromField);
                    Expr.Eq();
                    Expr.Field(TypeTo, TypeToAlias, mapping.ToField);
                    i++;
                }
            }
        }
示例#2
0
        internal ExprDataSource Clone()
        {
            var ret = new ExprDataSource
            {
                Alias       = this.Alias,
                Fields      = (this.Fields != null)? this.Fields.Select(p => p.Clone()).ToList():null,
                Schema      = this.Schema,
                Source      = (this.Source != null) ? this.Source.Clone() : null,
                Table       = this.Table,
                filter      = (this.filter != null) ? this.filter.Clone() : null,
                LeftSource  = (this.LeftSource != null) ? this.LeftSource.Clone() : null,
                RightSource = (this.RightSource != null) ? this.RightSource.Clone() : null,
                ParamExpr   = ParamExpr,
                JoinExpr    = (JoinExpr != null)?JoinExpr.Clone():null
            };

            return(ret);
        }
示例#3
0
        public static IQueryJoin EntityType(Type from, Type to, JoinExpr expr, QueryJoinType?joinType, string alias)
        {
            var typeJoin = (AbstractTypeJoin)_factory.CreateJoin(QueryJoinExpressionType.Type);

            typeJoin.TypeFrom = from;
            typeJoin.TypeTo   = to;
            if (expr != null)
            {
                typeJoin.Expr = expr;
            }
            if (joinType.HasValue)
            {
                typeJoin.JoinType = joinType.Value;
            }
            if (!string.IsNullOrEmpty(alias))
            {
                typeJoin.TypeToAlias = alias;
            }
            return(typeJoin);
        }
示例#4
0
 public static IQueryJoin EntityType(Type from, Type to, JoinExpr expr, String alias)
 {
     return(EntityType(from, to, expr, null, alias));
 }
示例#5
0
 public static IQueryJoin EntityType(Type from, Type to, JoinExpr expr)
 {
     return(EntityType(from, to, expr, null, null));
 }
示例#6
0
 public static IQueryJoin EntityType <T, TU>(JoinExpr expr, QueryJoinType?joinType, string alias)
 {
     return(EntityType(typeof(T), typeof(TU), expr, joinType, alias));
 }
示例#7
0
 public static IQueryJoin EntityType <T, TU>(JoinExpr expr, String alias)
 {
     return(EntityType(typeof(T), typeof(TU), expr, null, alias));
 }
示例#8
0
 public static IQueryJoin EntityType <T, TU>(JoinExpr expr)
 {
     return(EntityType(typeof(T), typeof(TU), expr, null, null));
 }