mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 02:32:50 +08:00
为多实例 不同表名规则情况下开放缓存机制,可使用MemoryCache等功能替换为实例缓存
避免全局静态缓存表名称无法替换
This commit is contained in:
parent
7926429393
commit
922f645249
@ -19,8 +19,10 @@ namespace FreeSql.Internal
|
|||||||
{
|
{
|
||||||
public class Utils
|
public class Utils
|
||||||
{
|
{
|
||||||
|
public static ConcurrentDictionary<DataType, ConcurrentDictionary<Type, TableInfo>> _cacheGetTableByEntity
|
||||||
static ConcurrentDictionary<DataType, ConcurrentDictionary<Type, TableInfo>> _cacheGetTableByEntity = new ConcurrentDictionary<DataType, ConcurrentDictionary<Type, TableInfo>>();
|
{
|
||||||
|
get; set;
|
||||||
|
} = new ConcurrentDictionary<DataType, ConcurrentDictionary<Type, TableInfo>>();
|
||||||
internal static void RemoveTableByEntity(Type entity, CommonUtils common)
|
internal static void RemoveTableByEntity(Type entity, CommonUtils common)
|
||||||
{
|
{
|
||||||
if (entity.IsAnonymousType() ||
|
if (entity.IsAnonymousType() ||
|
||||||
@ -534,7 +536,7 @@ namespace FreeSql.Internal
|
|||||||
{
|
{
|
||||||
col.Attribute.IsNullable = false;
|
col.Attribute.IsNullable = false;
|
||||||
col.Attribute.DbType = col.Attribute.DbType.Replace("NOT NULL", "").Replace(" NULL", "").Trim();
|
col.Attribute.DbType = col.Attribute.DbType.Replace("NOT NULL", "").Replace(" NULL", "").Trim();
|
||||||
switch(common._orm.Ado.DataType)
|
switch (common._orm.Ado.DataType)
|
||||||
{
|
{
|
||||||
case DataType.Sqlite:
|
case DataType.Sqlite:
|
||||||
col.Attribute.DbType += " NOT NULL"; //sqlite 主键也可以插入 null
|
col.Attribute.DbType += " NOT NULL"; //sqlite 主键也可以插入 null
|
||||||
|
Loading…
x
Reference in New Issue
Block a user