public class Record<T>
where T:class
{
private System.Collections.Generic.Dictionary<string, object> m_Record = null;
private static readonly System.Collections.Generic.Dictionary<Entities.RecordMapping,System.Reflection.PropertyInfo> PatternRecordMappingList;
static Record()
{
Record<T>.PatternRecordMappingList = new Dictionary<RecordMapping, System.Reflection.PropertyInfo>();
Type PatternType = typeof(T);
System.Reflection.PropertyInfo[] PatternTypeProperties = PatternType.GetProperties();
foreach (var Item in PatternTypeProperties)
{
object[] Result = Item.GetCustomAttributes(true);
foreach (var Mapping in Result)
{
if (Mapping.GetType() == typeof(Entities.RecordMapping))
Record<T>.PatternRecordMappingList.Add(Mapping as Entities.RecordMapping,Item);
}
}
}
public Record(System.Data.IDataReader Reader)
{
this.Initialize(Reader);
}
protected void Initialize(System.Data.IDataReader Reader)
{
object c = Reader[0];
this.m_Record = new Dictionary<string, object>(Reader.FieldCount);
for (int Index = 0; Index < Reader.FieldCount; Index++)
{
this.m_Record.Add(Reader.GetName(Index), Reader[Index]);
}
}
public T Entity()
{
Type EntityType = typeof(T);
详细解决方案
写了个Record类,求一上
热度:6490 发布时间:2013-02-25 00:00:00.0
相关解决方案
- Is it OK to record?该如何处理
- poi导入excel出现 Initialisation of record 0x86 left 2 bytes remaining still to be re解决办法
- process32First 和 process32Next 在编译时出现 error A2006: -benign record redefinition 错解决办法
- 那边有关于Address Of Record 解析的代码
- 那里有关于Address Of Record 解析的代码?该如何处理
- DirectShow record WMV解决办法
- 非WEB程序中应用Active Record
- Ext.data课题三:Ext.data.Record
- 非WEB程序中施用Active Record
- [转载]EXT核心API详解(8)-Ext.dat-Connection/Ajax/Record javascript
- Unable to construct record instance,该如何处理
- List<Record> 转换成object[][]解决方法
- java 获取 table of record,该如何处理
- constant record 类型的初始化有关问题
- javax.net.ssl.SSLException: Unsupported record
- 请教在PPC平台用VC++2005怎么对音频文件进行控件?PLAY &RECORD
- select * from table where file1='" & "a:" & Trim(record) & "' ,为什么要& "a:" & ,是什么意思?该怎么解决
- FRM-41839: Disk I/O error on temporary record buffer file /tmp/.TMP
- oracle 复合门类-record、数组、%type、%rowtype、plsql table类型
- UNABLE TO PURGE A RECORD(2)
- Bug #19528825 "UNABLE TO PURGE A RECORD"
- Antd Table (index.js:1 Warning: [antd: Table] Each record in dataSource of table should have a un...
- Mybatis-Plus使用AR(Active Record)(三)
- Property ‘datetimerangeValue‘ does not exist on type ‘CombinedVueInstance<Record<never, any> Vue,
- 【Audio Record】安卓手机录音前1s内静音处理
- 【2021-05-27】 Learning progress record
- ACM STUDT NOTE(Record every good moment)
- Error([('SSL routines', 'ssl3_get_record', 'decryption failed or bad record mac')]) 解决办法
- Oracle Record Table Type (行与表对象类型用法)
- 通过一个例子详解 MySQL record lock(记录锁) 的加锁方式