Beispiel #1
0
 protected internal EntityDbMap GetDbMap <T>()
 {
     return(EntityDbMap.GetOrAdd <T>(() =>
     {
         var entityType = Model.FindEntityType(typeof(T));
         if (entityType == null)
         {
             throw new Exception($"从{GetType().Name}获取{typeof(T)}的配置失败");
         }
         return entityType;
     }));
 }
Beispiel #2
0
        internal static EntityDbMap GetOrAdd <T>(Func <IEntityType> getEntity)
        {
            var key = typeof(T);

            if (MapCache.TryGetValue(key, out var map))
            {
                return(map);
            }

            //新建
            map = new EntityDbMap(getEntity());
            return(MapCache.SetValue(key, map));
        }