mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-20 12:58:15 +08:00
arrange
This commit is contained in:
@ -24,10 +24,10 @@ namespace FreeSql.Internal {
|
||||
class Utils {
|
||||
|
||||
static ConcurrentDictionary<string, ConcurrentDictionary<Type, TableInfo>> _cacheGetTableByEntity = new ConcurrentDictionary<string, ConcurrentDictionary<Type, TableInfo>>();
|
||||
internal static TableInfo GetTableByEntity(Type entity, CommonUtils common) {
|
||||
internal static TableInfo GetTableByEntity(Type entity, CommonUtils common, bool isReCache = false) {
|
||||
if (entity.FullName.StartsWith("<>f__AnonymousType")) return null;
|
||||
var tbc = _cacheGetTableByEntity.GetOrAdd(common.DbName, k1 => new ConcurrentDictionary<Type, TableInfo>()); //区分数据库类型缓存
|
||||
if (tbc.TryGetValue(entity, out var trytb)) return trytb;
|
||||
if (isReCache == false && tbc.TryGetValue(entity, out var trytb)) return trytb;
|
||||
if (common.CodeFirst.GetDbInfo(entity) != null) return null;
|
||||
|
||||
var tbattr = common.GetEntityTableAttribute(entity);
|
||||
@ -105,7 +105,7 @@ namespace FreeSql.Internal {
|
||||
foreach (var col in trytb.Primarys)
|
||||
col.Attribute.IsPrimary = true;
|
||||
}
|
||||
tbc.TryAdd(entity, trytb);
|
||||
tbc.AddOrUpdate(entity, trytb, (oldkey, oldval) => trytb);
|
||||
|
||||
#region virtual 属性延时加载,动态产生新的重写类
|
||||
if (common.CodeFirst.IsLazyLoading && propsLazy.Any()) {
|
||||
|
Reference in New Issue
Block a user