Ejemplo n.º 1
0
 private void DB2Operate()
 {
     entities = new DB2Entities <T>(tableName);
     DB2.GetSomeData(sql);
     foreach (DataRow dr in DB2.dt.Rows)
     {
         T t = new T();
         // 获得此模型的公共属性
         PropertyInfo[] propertys = t.GetType().GetProperties();
         foreach (PropertyInfo pi in propertys)
         {
             if (DB2.dt.Columns.Contains(pi.Name))
             {
                 if (!pi.CanWrite)
                 {
                     continue;
                 }
                 object value = dr[pi.Name];
                 if (value != DBNull.Value)
                 {
                     pi.SetValue(t, value, null);
                 }
             }
         }
         entities.EntityList.Add(t);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// DB2实体集合构造函数
 /// </summary>
 /// <param name="tableName">指定表名</param>
 public DB2DataCatcher(string tableName, string sql = "")
 {
     entities = new DB2Entities <T>(tableName);
     _sql     = sql;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// DB2实体集合构造函数
 /// </summary>
 /// <param name="tableName">指定表名</param>
 public DB2OperDataPusher(string tableName, DB2Oper db2)
 {
     entities = new DB2Entities <T>(tableName);
     DB2      = db2;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// DB2实体集合构造函数
 /// </summary>
 /// <param name="tableName">指定表名</param>
 public DB2DataPusher(string tableName)
 {
     entities = new DB2Entities <T>(tableName);
 }