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);
T EntityObject = Activator.CreateInstance(EntityType) as T;
foreach (var Item in Record<T>.PatternRecordMappingList)