sqlsugar配置模式化列服务和表服务

This commit is contained in:
falcon 2022-10-21 09:14:28 +08:00
parent 231d546e5d
commit 90bdb831c7
3 changed files with 8 additions and 2 deletions

View File

@ -14,6 +14,11 @@ namespace Falcon.SugarApi.DatabaseDefinitions.EntityServices
if (p.TryGetAttribute<KeyAttribute>(out var _)) { if (p.TryGetAttribute<KeyAttribute>(out var _)) {
c.IsPrimarykey = true; c.IsPrimarykey = true;
} }
//属性只要加了SugarColumn特性不管是不是增加SugarColumn(IsPrimarykey=false),IsPrimarykey都是false
//只要存在SugarColumn特性KeyAttribute便会无效。
//if (p.TryGetAttribute<SugarColumn>(out var sc)) {
// c.IsPrimarykey = sc.IsPrimaryKey;
//}
} }
} }
} }

View File

@ -20,6 +20,9 @@ namespace Falcon.SugarApi.DatabaseDefinitions.EntityServices
if (p.TryGetAttribute<MaxLengthAttribute>(out var la)) { if (p.TryGetAttribute<MaxLengthAttribute>(out var la)) {
len.Add(la.Length); len.Add(la.Length);
} }
if (p.TryGetAttribute<SugarColumn>(out var sc)) {
len.Add(sc.Length);
}
if (len.Any()) { if (len.Any()) {
c.Length = len.Max(); c.Length = len.Max();
} }

View File

@ -54,8 +54,6 @@ namespace Falcon.SugarApi.DatabaseDefinitions
}; };
} }
private static ICacheService? CacheService = null;
/// <summary> /// <summary>
/// 通过配置实现Redis缓冲必须单例实现. /// 通过配置实现Redis缓冲必须单例实现.
/// <para>默认:127.0.0.1:6379,password=,connectTimeout=3000,connectRetry=1,syncTimeout=10000,DefaultDatabase=0</para> /// <para>默认:127.0.0.1:6379,password=,connectTimeout=3000,connectRetry=1,syncTimeout=10000,DefaultDatabase=0</para>