public static void Set(string key, OrmModel value) { if (!OrmCache.CacheList.ContainsKey(key)) { OrmCache.CacheList.Add(key, value); } }
public static OrmModel Get(string key) { OrmModel result = null; if (OrmCache.CacheList.ContainsKey(key)) { result = OrmCache.CacheList[key]; } return(result); }
protected OrmModel GetMappedModel <T>() where T : class, new() { OrmModel result = null; { Type entityType = typeof(T); string key = entityType.FullName; /**/ result = OrmCache.Get(key); if (result == null) { result = new OrmModel(); result.Table = Attribute.GetCustomAttribute ( entityType, typeof(OrmTableAttribute) ) as OrmTableAttribute; /**/ result.Columns = new Dictionary <string, OrmColumnAttribute>(); foreach (PropertyInfo objPropertyInfo in entityType.GetProperties()) { OrmColumnAttribute temp = objPropertyInfo.GetCustomAttributes ( typeof(OrmColumnAttribute), false )[0] as OrmColumnAttribute; temp.MappedPropertyInfo = objPropertyInfo; /**/ result.Columns.Add(temp.ColumName, temp); } /**/ OrmCache.Set(key, result); } return(result); } }