- 增加 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:
28810
2019-10-12 01:02:42 +08:00
parent 9a8d51da50
commit e823f9dcd0
43 changed files with 285 additions and 146 deletions

View File

@ -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>();
}