毕业论文开发语言企业开发JAVA技术.NET技术WEB开发Linux/Unix数据库技术Windows平台移动平台嵌入式论文范文英语论文
您现在的位置: 毕业论文 >> net技术 >> 正文

Record类源代码

更新时间:2012-7-21:  来源:毕业论文

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)

[1] [2] [3] 下一页

设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©lwfree.com 六维论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。