コード例 #1
0
 public static object GetInstance(Type type, int id)
 {
     if (!type.IsSubclassOf(typeof(DataEntry)))
     {
         throw new ArgumentException(string.Format("Type {0} is not subclass of {1}", type.Name, typeof(DataEntry).Name));
     }
     if (!DataEntry._dataEntriesPool.ContainsKey(type))
     {
         DataEntry._dataEntriesPool[type] = new Dictionary <int, object>();
     }
     if (DataEntry._dataEntriesPool[type].ContainsKey(id))
     {
         return(DataEntry._dataEntriesPool[type][id]);
     }
     //object obj = DatabaseManager.Select(type, id);
     //if (obj != null)
     //{
     //	return obj;
     //}
     return(ReflectionUtilities.Construct(type, new object[] { id }));
 }