예제 #1
0
 static async void TaskAsyncLoad(EntityMapperCacheManager cache, IEnumerable <Type> types) => await Task.Run(() =>
 {
     foreach (var t in types)
     {
         var et = t.BaseType.GetGenericArguments().SingleOrDefault();
         if (et != null)
         {
             var entityName = et.Name;
             if (!cache.ContainsKey(entityName))
             {
                 var e = new EntityMapperCacheItem(entityName)
                 {
                     Value  = ReflectionMethod.CreateObject(cache._assembly, t),
                     Expire = DateTime.MaxValue,
                     Type   = CacheType.Application
                 };
                 cache.Add(e.Key, e);
             }
         }
     }
 });
예제 #2
0
 public static EntityMapperCacheManager GetMapperCacheManager(System.Reflection.Assembly assembly = null)
 {
     instance = instance ?? new EntityMapperCacheManager(assembly);
     return(instance);
 }