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类,求一下
热度:1108 发布时间:2016-05-01 22:44:54.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解决办法
- Ext.data课题三:Ext.data.Record
- 非WEB程序中施用Active Record
- [转载]EXT核心API详解(8)-Ext.dat-Connection/Ajax/Record javascript
- List<Record> 转换成object[][]解决方法
- java 获取 table of record,该如何处理
- 请教在PPC平台用VC++2005怎么对音频文件进行控件?PLAY &RECORD
- select * from table where file1='" & "a:" & Trim(record) & "' ,为什么要& "a:" & ,是什么意思?该怎么解决
- oracle 复合门类-record、数组、%type、%rowtype、plsql table类型
- Antd Table (index.js:1 Warning: [antd: Table] Each record in dataSource of table should have a un...
- Oracle Record Table Type (行与表对象类型用法)
- 通过一个例子详解 MySQL record lock(记录锁) 的加锁方式
- Record Your Rationale
- DBminitor|P6Spy---- record sql
- 解决[1]:XLRDError: Unsupported format, or corrupt file: Expected BOF record; found b'id\xef\xbc\x8cage
- oracle record table 一个实例
- Ext Record
- Could not buffer record
- 05.数据的基本语法 Record