mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-24 11:42:51 +08:00

> 文档: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 实体类型的元数据;
43 lines
1.0 KiB
C#
43 lines
1.0 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Data.Common;
|
||
|
||
namespace FreeSql
|
||
{
|
||
public interface IUnitOfWork : IDisposable
|
||
{
|
||
|
||
DbTransaction GetOrBeginTransaction(bool isCreate = true);
|
||
|
||
IsolationLevel? IsolationLevel { get; set; }
|
||
|
||
/// <summary>
|
||
/// 是否启用工作单元
|
||
/// </summary>
|
||
bool Enable { get; }
|
||
|
||
void Commit();
|
||
|
||
void Rollback();
|
||
|
||
/// <summary>
|
||
/// 禁用工作单元
|
||
/// <exception cref="Exception"></exception>
|
||
/// <para></para>
|
||
/// 若已开启事务(已有Insert/Update/Delete操作),调用此方法将发生异常,建议在执行逻辑前调用
|
||
/// </summary>
|
||
void Close();
|
||
|
||
/// <summary>
|
||
/// 开启工作单元
|
||
/// </summary>
|
||
void Open();
|
||
|
||
/// <summary>
|
||
/// 实体变化事件
|
||
/// </summary>
|
||
Action<List<DbContext.EntityChangeInfo>> OnEntityChange { get; set; }
|
||
}
|
||
}
|