mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-04-02 15:16:37 +08:00
替换Sqlsugar默认序列化器,解决.Select()映射嵌套/匿名类时,实体的非公有访问器 值无法绑定,如Id(protect属性)
This commit is contained in:
@@ -40,6 +40,9 @@ namespace Yi.Framework.SqlSugarCore
|
||||
public IEntityChangeEventHelper EntityChangeEventHelper => LazyServiceProvider.LazyGetService<IEntityChangeEventHelper>(NullEntityChangeEventHelper.Instance);
|
||||
public DbConnOptions Options => LazyServiceProvider.LazyGetRequiredService<IOptions<DbConnOptions>>().Value;
|
||||
public AbpDbConnectionOptions ConnectionOptions => LazyServiceProvider.LazyGetRequiredService<IOptions<AbpDbConnectionOptions>>().Value;
|
||||
|
||||
public ISerializeService SerializeService=> LazyServiceProvider.LazyGetRequiredService<ISerializeService>();
|
||||
|
||||
private ISqlSugarDbConnectionCreator _dbConnectionCreator;
|
||||
|
||||
public void SetSqlSugarClient(ISqlSugarClient sqlSugarClient)
|
||||
@@ -63,6 +66,8 @@ namespace Yi.Framework.SqlSugarCore
|
||||
options.DbType = GetCurrentDbType();
|
||||
}));
|
||||
connectionCreator.SetDbAop(SqlSugarClient);
|
||||
//替换默认序列化器
|
||||
SqlSugarClient.CurrentConnectionConfig.ConfigureExternalServices.SerializeService = SerializeService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user