mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-18 20:08:15 +08:00
- 增加 FreeSql.DbContext 实体对象的变化事件;
> 文档:https://github.com/2881099/FreeSql/wiki/DbContext#%E5%AE%9E%E4%BD%93%E5%8F%98%E5%8C%96%E4%BA%8B%E4%BB%B6 - 补充 Aop.CurdBefore 事件参数 Table 实体类型的元数据;
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
using FreeSql;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public static class FreeSqlDbContextExtensions
|
||||
{
|
||||
@ -31,12 +32,13 @@ public static class FreeSqlDbContextExtensions
|
||||
/// </summary>
|
||||
/// <param name="that"></param>
|
||||
/// <param name="options"></param>
|
||||
public static void SetDbContextOptions(this IFreeSql that, Action<DbContextOptions> options)
|
||||
public static IFreeSql SetDbContextOptions(this IFreeSql that, Action<DbContextOptions> options)
|
||||
{
|
||||
if (options == null) return;
|
||||
if (options == null) return that;
|
||||
var cfg = _dicSetDbContextOptions.GetOrAdd(that, t => new DbContextOptions());
|
||||
options(cfg);
|
||||
_dicSetDbContextOptions.AddOrUpdate(that, cfg, (t, o) => cfg);
|
||||
return that;
|
||||
}
|
||||
internal static ConcurrentDictionary<IFreeSql, DbContextOptions> _dicSetDbContextOptions = new ConcurrentDictionary<IFreeSql, DbContextOptions>();
|
||||
}
|
Reference in New Issue
Block a user