Exemple #1
0
 public DBHelperBase()
 {
     this._conn   = this.GetIDbConntion();
     this._mapper = EntityMapperCacheManager.GetMapperCacheManager()[typeof(T).Name].Value;
     this._bat    = this.GetDBbatBuilder();
     this._entity = new T();
 }
Exemple #2
0
        private IDbCommand InitiCommand(IDBbatBuilder commandText, object paramObj)
        {
            var com = this._conn.GetIDbCommand(this._mapper.ServiceKey);

            com.CommandText = commandText.ToString();
            com.CommandType = CommandType.Text;
            commandText.SetCommandParameter(com.CommandText, com.Parameters, paramObj);
            return(com);
        }
Exemple #3
0
        public void Union(IDBbatBuilder source)
        {
            var a = source as DBbatBuilder <T>;

            this._sqltext.AppendLine("union");
            this._sqltext.AppendLine(source.ToString());
            if (a.where != null)
            {
                this.where.ChildItem = a.where;
            }
        }
Exemple #4
0
 public void Execute <K>(IList <T> entitys, IDBbatBuilder commandText, object paramObj = null) where K : DataEntity, new()
 {
     try
     {
         IDbCommand com = InitiCommand(commandText, paramObj);
         using (var read = com.ExecuteReader(CommandBehavior.CloseConnection))
         {
             var rs = ReaderDataEntity.CreaterReaderDataEntity <T, K>(this._entity, read, this._mapper);
             rs.FullDataEntity <T>(entitys, read);
         }
     }
     finally
     {
         this._conn.Close();
     }
 }