public virtual ISugarQueryable <T, T2, T3> Queryable <T, T2, T3>(Expression <Func <T, T2, T3, object[]> > joinExpression) where T : class, new() { InitMppingInfo <T, T2, T3>(); var types = new Type[] { typeof(T2), typeof(T3) }; var queryable = InstanceFactory.GetQueryable <T, T2, T3>(base.CurrentConnectionConfig); base.CreateQueryJoin(joinExpression, types, queryable); return(queryable); }
public virtual ISugarQueryable <T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Queryable <T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Expression <Func <T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, object[]> > joinExpression) where T : class, new() { InitMppingInfo <T, T2, T3, T4, T5, T6, T8, T9, T10, T11, T12>(); var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12) }; var queryable = InstanceFactory.GetQueryable <T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(base.CurrentConnectionConfig); base.CreateQueryJoin(joinExpression, types, queryable); return(queryable); }
public virtual ISugarQueryable <T, T2, T3, T4, T5, T6, T7, T8, T9> Queryable <T, T2, T3, T4, T5, T6, T7, T8, T9>(Expression <Func <T, T2, T3, T4, T5, T6, T7, T8, T9, object[]> > joinExpression) { InitMppingInfo <T, T2, T3, T4, T5, T6, T7, T8, T9>(); var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9) }; var queryable = InstanceFactory.GetQueryable <T, T2, T3, T4, T5, T6, T7, T8, T9>(this.CurrentConnectionConfig); this.CreateQueryJoin(joinExpression, types, queryable); return(queryable); }
public virtual ISugarQueryable <T, T2> Queryable <T, T2>(Expression <Func <T, T2, object[]> > joinExpression) { InitMppingInfo <T, T2>(); var types = new Type[] { typeof(T2) }; var queryable = InstanceFactory.GetQueryable <T, T2>(this.CurrentConnectionConfig); this.CreateQueryJoin(joinExpression, types, queryable); return(queryable); }
public virtual ISugarQueryable <T, T2, T3, T4, T5, T6, T7, T8> Queryable <T, T2, T3, T4, T5, T6, T7, T8>(Expression <Func <T, T2, T3, T4, T5, T6, T7, T8, bool> > joinExpression) where T : class, new() { InitMppingInfo <T, T2, T3, T4, T5, T6, T8>(); var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8) }; var queryable = InstanceFactory.GetQueryable <T, T2, T3, T4, T5, T6, T7, T8>(base.CurrentConnectionConfig); base.CreateEasyQueryJoin(joinExpression, types, queryable); queryable.Where(joinExpression); return(queryable); }
public virtual ISugarQueryable <T, T2> Queryable <T, T2>(Expression <Func <T, T2, bool> > joinExpression) where T : class, new() { InitMppingInfo <T, T2>(); var types = new Type[] { typeof(T2) }; var queryable = InstanceFactory.GetQueryable <T, T2>(this.CurrentConnectionConfig); this.CreateEasyQueryJoin(joinExpression, types, queryable); queryable.Where(joinExpression); return(queryable); }
public virtual ISugarQueryable <T, T2> Queryable <T, T2>( ISugarQueryable <T> joinQueryable1, ISugarQueryable <T2> joinQueryable2, JoinType joinType, Expression <Func <T, T2, bool> > joinExpression) where T : class, new() where T2 : class, new() { Check.Exception(joinQueryable1.QueryBuilder.Take != null || joinQueryable1.QueryBuilder.Skip != null || joinQueryable1.QueryBuilder.OrderByValue.HasValue(), "joinQueryable1 Cannot have 'Skip' 'ToPageList' 'Take' Or 'OrderBy'"); Check.Exception(joinQueryable2.QueryBuilder.Take != null || joinQueryable2.QueryBuilder.Skip != null || joinQueryable2.QueryBuilder.OrderByValue.HasValue(), "joinQueryable2 Cannot have 'Skip' 'ToPageList' 'Take' Or 'OrderBy'"); var sqlBuilder = InstanceFactory.GetSqlbuilder(base.Context.CurrentConnectionConfig); sqlBuilder.Context = base.Context; InitMppingInfo <T, T2>(); var types = new Type[] { typeof(T2) }; var queryable = InstanceFactory.GetQueryable <T, T2>(base.CurrentConnectionConfig); queryable.Context = base.Context; queryable.SqlBuilder = sqlBuilder; queryable.QueryBuilder = InstanceFactory.GetQueryBuilder(base.CurrentConnectionConfig); queryable.QueryBuilder.JoinQueryInfos = new List <JoinQueryInfo>(); queryable.QueryBuilder.Builder = sqlBuilder; queryable.QueryBuilder.Context = base.Context; queryable.QueryBuilder.EntityType = typeof(T); queryable.QueryBuilder.LambdaExpressions = InstanceFactory.GetLambdaExpressions(base.CurrentConnectionConfig); //master var shortName1 = joinExpression.Parameters[0].Name; var sqlObj1 = joinQueryable1.ToSql(); string sql1 = sqlObj1.Key; UtilMethods.RepairReplicationParameters(ref sql1, sqlObj1.Value.ToArray(), 0); queryable.QueryBuilder.EntityName = sqlBuilder.GetPackTable(sql1, shortName1);; queryable.QueryBuilder.Parameters.AddRange(sqlObj1.Value); //join table 1 var shortName2 = joinExpression.Parameters[1].Name; var sqlObj2 = joinQueryable2.ToSql(); string sql2 = sqlObj2.Key; UtilMethods.RepairReplicationParameters(ref sql2, sqlObj2.Value.ToArray(), 1); queryable.QueryBuilder.Parameters.AddRange(sqlObj2.Value); var exp = queryable.QueryBuilder.GetExpressionValue(joinExpression, ResolveExpressType.WhereMultiple); queryable.QueryBuilder.JoinQueryInfos.Add(new JoinQueryInfo() { JoinIndex = 0, JoinType = joinType, JoinWhere = exp.GetResultString(), TableName = sqlBuilder.GetPackTable(sql2, shortName2) }); return(queryable); }
protected ISugarQueryable <T> CreateQueryable <T>() where T : class, new() { ISugarQueryable <T> result = InstanceFactory.GetQueryable <T>(this.CurrentConnectionConfig); return(CreateQueryable(result)); }