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); } } } });
public static EntityMapperCacheManager GetMapperCacheManager(System.Reflection.Assembly assembly = null) { instance = instance ?? new EntityMapperCacheManager(assembly); return(instance); }