Esempio n. 1
0
 public static void Set(string key, OrmModel value)
 {
     if (!OrmCache.CacheList.ContainsKey(key))
     {
         OrmCache.CacheList.Add(key, value);
     }
 }
Esempio n. 2
0
 public static void Set(string key, OrmModel value)
 {
     if (!OrmCache.CacheList.ContainsKey(key))
     {
         OrmCache.CacheList.Add(key, value);
     }
 }
Esempio n. 3
0
        public static OrmModel Get(string key)
        {
            OrmModel result = null;

            if (OrmCache.CacheList.ContainsKey(key))
            {
                result = OrmCache.CacheList[key];
            }

            return(result);
        }
Esempio n. 4
0
        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);
            }
        }