2020-04-24 23:13:50 +08:00

54 lines
1.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
namespace FreeSql
{
/// <summary>
/// 工作单元
/// </summary>
public interface IUnitOfWork : IDisposable
{
/// <summary>
/// 开启事务,或者返回已开启的事务
/// </summary>
/// <param name="isCreate">若未开启事务,则开启</param>
/// <returns></returns>
DbTransaction GetOrBeginTransaction(bool isCreate = true);
IsolationLevel? IsolationLevel { get; set; }
void Commit();
void Rollback();
/// <summary>
/// 是否启用工作单元
/// </summary>
[Obsolete("即将删除保留到2020-08-01请改用 UnitOfWorkManager 的方式管理事务 https://github.com/dotnetcore/FreeSql/issues/289")]
bool Enable { get; }
/// <summary>
/// 禁用工作单元
/// <exception cref="Exception"></exception>
/// <para></para>
/// 若已开启事务已有Insert/Update/Delete操作调用此方法将发生异常建议在执行逻辑前调用
/// </summary>
[Obsolete("即将删除保留到2020-08-01请改用 UnitOfWorkManager 的方式管理事务 https://github.com/dotnetcore/FreeSql/issues/289")]
void Close();
/// <summary>
/// 开启工作单元
/// </summary>
[Obsolete("即将删除保留到2020-08-01请改用 UnitOfWorkManager 的方式管理事务 https://github.com/dotnetcore/FreeSql/issues/289")]
void Open();
/// <summary>
/// 工作单元内的实体变化跟踪
/// </summary>
DbContext.EntityChangeReport EntityChangeReport { get; }
}
}