Пример #1
0
 public void AddHeader(ColumnRelevanceMapper column)
 {
     if (column != null)
     {
         Header.Add(column);
     }
 }
Пример #2
0
 public void AddWhere(ColumnRelevanceMapper column)
 {
     if (column != null)
     {
         Where.Add(column);
     }
 }
        public IEnumerable <Tuple <T, K> > ExecuteReader <K>(IBatch batch, List <ColumnRelevanceMapper> mapper) where K : IEntity, new()
        {
            List <Tuple <T, K> > entitybuffer = new List <Tuple <T, K> >(128);

            using (var Connection = Create.CreateConnection())
            {
                var reader = Connection.ExecuteReader(batch.SqlBuilder, batch.DynamicParameters, commandTimeout: 3600);
                while (reader.Read())
                {
                    T    t  = new T();
                    Type t1 = typeof(T);
                    K    k  = new K();
                    Type k1 = typeof(K);
                    for (Int32 i = 0; i < reader.FieldCount; i++)
                    {
                        Object obj = reader.GetValue(i);
                        if (obj != null)
                        {
                            ColumnRelevanceMapper column = mapper[i];
                            if (column.TableName == t1)
                            {
                                PropertyValueExpression <T> .SetValue(t, column.ColumnName, obj);
                            }
                            else
                            {
                                PropertyValueExpression <K> .SetValue(k, column.ColumnName, obj);
                            }
                        }
                    }
                    Tuple <T, K> tuple = new Tuple <T, K>(t, k);
                    entitybuffer.Add(tuple);
                }
            }
            return(entitybuffer);
        }
Пример #4
0
 public QuerySQLHelper AddWhere(ColumnRelevanceMapper column)
 {
     if (column != null)
     {
         Where.Add(column);
     }
     return(this);
 }
Пример #5
0
 public QuerySQLHelper AddQuery(ColumnRelevanceMapper column)
 {
     lock (_lock)
     {
         Query.Add(column);
     }
     return(this);
 }
Пример #6
0
 public QuerySQLHelper()
 {
     Query   = new List <ColumnRelevanceMapper>();
     Top     = new ColumnRelevanceMapper();
     Table   = new List <TableRelevanceMapper>();
     Where   = new List <ColumnRelevanceMapper>();
     Orderby = new List <String>();
 }
Пример #7
0
 /// <summary>
 /// 每次的行操作都会判断前面的执行方式
 /// </summary>
 /// <param name="column"></param>
 protected virtual void AddColumn(ColumnRelevanceMapper column)
 {
     if (_sqlOperatorEnum != SqlOperatorEnum.None)
     {
         column.SqlOperatorEnum = _sqlOperatorEnum;
         //初始化sql操作
         _sqlOperatorEnum = SqlOperatorEnum.None;
     }
     ReduceSql.Add(column);
 }
Пример #8
0
        public QueryParameterReduce AddQuery(Type type, String columnName)
        {
            ColumnRelevanceMapper column = new ColumnRelevanceMapper
            {
                ColumnName = columnName,
                TableName  = type
            };

            AddQuery(column);
            return(this);
        }
Пример #9
0
        /// <summary>
        /// 添加属性名,注意,此处是添加首先解析的字段
        /// 如 a.id = b.id 那么此处解析 a.id
        /// </summary>
        /// <param name="name"></param>
        /// <param name="value"></param>
        public void Add(String name, Object value)
        {
            ColumnRelevanceMapper column = new ColumnRelevanceMapper();

            if (value != null)
            {
                column.ColumnName = $"{name}";
            }
            Parameters.Add(name, value);
            //添加@name的模式
            AddColumn(column);
        }
Пример #10
0
 public BatchParameterReduce AddWhere(ColumnRelevanceMapper column)
 {
     RenewalHelper.AddWhere(column);
     return(this);
 }
Пример #11
0
 public QueryParameterReduce AddQuery(ColumnRelevanceMapper column)
 {
     QueryHelper.AddQuery(column);
     return(this);
 }
Пример #12
0
 /// <summary>
 /// 添加字段映射
 /// </summary>
 /// <param name="column"></param>
 public void Add(ColumnRelevanceMapper column)
 {
     AddColumn(column);
 }