CommitFailureHandler 类
[本页针对的是实体框架版本 6。最新版本以“实体框架”NuGet 包的形式提供。有关实体框架的更多信息,请参见 msdn.com/data/ef。]
表示事务处理程序,该程序允许在事务提交期间通过在数据库中存储事务跟踪信息,来从连接故障中正常恢复。 需要使用 SetDefaultTransactionHandler(Func<TransactionHandler>) 注册它。
继承层次结构
System.Object
System.Data.Entity.Infrastructure.TransactionHandler
System.Data.Entity.Infrastructure.CommitFailureHandler
命名空间: System.Data.Entity.Infrastructure
程序集: EntityFramework(在 EntityFramework.dll 中)
语法
声明
Public Class CommitFailureHandler _
Inherits TransactionHandler
用法
Dim instance As CommitFailureHandler
public class CommitFailureHandler : TransactionHandler
public ref class CommitFailureHandler : public TransactionHandler
type CommitFailureHandler =
class
inherit TransactionHandler
end
public class CommitFailureHandler extends TransactionHandler
CommitFailureHandler 类型公开以下成员。
构造函数
顶部
属性
顶部
方法
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
BeganTransaction |
将新事务的跟踪信息存储到同一事务中的数据库。 (重写 TransactionHandler.BeganTransaction(DbConnection, BeginTransactionInterceptionContext)。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
BeginningTransaction |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
BuildDatabaseInitializationScript |
生成数据库初始化脚本。 (重写 TransactionHandler.BuildDatabaseInitializationScript()。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
ClearTransactionHistory |
删除所有事务历史记录。 |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
ClearTransactionHistoryAsync() |
异步删除所有事务历史记录。 |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
ClearTransactionHistoryAsync(CancellationToken) |
异步删除所有事务历史记录。 |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
Closed |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
Closing |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
Committed |
如果引发了异常,请检查此事务的数据库,如果找不到,则会再次引发异常。否则将提交标记为成功并为将删除的事务信息进行排队。 (重写 TransactionHandler.Committed(DbTransaction, DbTransactionInterceptionContext)。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
Committing |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
ConnectionGetting |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
ConnectionGot |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
ConnectionStringGetting |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
ConnectionStringGot |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
ConnectionStringSet |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
ConnectionStringSetting |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
ConnectionTimeoutGetting |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
ConnectionTimeoutGot |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
DatabaseGetting |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
DatabaseGot |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
DataSourceGetting |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
DataSourceGot |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
Dispose() |
释放此事务处理程序占用的资源。 (继承自 TransactionHandler。) |
![受保护的方法 受保护的方法](images/ee705318.protmethod(vs.113).gif) |
Dispose(Boolean) |
释放此事务对象占用的资源。 (重写 TransactionHandler.Dispose(Boolean)。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
Disposed(DbTransaction, DbTransactionInterceptionContext) |
停止跟踪已处理的事务。 (重写 TransactionHandler.Disposed(DbTransaction, DbTransactionInterceptionContext)。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
Disposed(DbConnection, DbConnectionInterceptionContext) |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
Disposing(DbConnection, DbConnectionInterceptionContext) |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
Disposing(DbTransaction, DbTransactionInterceptionContext) |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
EnlistedTransaction |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
EnlistingTransaction |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
Equals |
(继承自 Object。) |
![受保护的方法 受保护的方法](images/ee705318.protmethod(vs.113).gif) |
Finalize |
(继承自 Object。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) ![静态成员 静态成员](images/dn619172.static(vs.113).gif) |
FromContext(DbContext) |
获取与 context 关联的 CommitFailureHandler(如果存在);否则返回 null。 |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) ![静态成员 静态成员](images/dn619172.static(vs.113).gif) |
FromContext(ObjectContext) |
获取与 context 关联的 CommitFailureHandler(如果存在);否则返回 null。 |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
GetHashCode |
(继承自 Object。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
GetType |
(继承自 Object。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
Initialize(ObjectContext) |
初始化实例的属性。 (重写 TransactionHandler.Initialize(ObjectContext)。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
Initialize(DbContext, DbConnection) |
初始化实例的属性。 (重写 TransactionHandler.Initialize(DbContext, DbConnection)。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
IsolationLevelGetting |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
IsolationLevelGot |
可在派生类中实现。 (继承自 TransactionHandler。) |
![受保护的方法 受保护的方法](images/ee705318.protmethod(vs.113).gif) |
MarkTransactionForPruning |
将指定事务添加到可从数据库中删除的事务列表 |
![受保护的方法 受保护的方法](images/ee705318.protmethod(vs.113).gif) |
MatchesParentContext |
检查提供的侦听上下文是否包含目标上下文,或提供的连接与目标上下文使用的连接相同。 (继承自 TransactionHandler。) |
![受保护的方法 受保护的方法](images/ee705318.protmethod(vs.113).gif) |
MemberwiseClone |
(继承自 Object。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
Opened |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
Opening |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
PruneTransactionHistory() |
删除标记为删除的事务。 |
![受保护的方法 受保护的方法](images/ee705318.protmethod(vs.113).gif) |
PruneTransactionHistory(Boolean, Boolean) |
如果标记为删除的事务的数目超出 PruningLimit,则删除这些事务。 |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
PruneTransactionHistoryAsync() |
异步删除标记为删除的事务。 |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
PruneTransactionHistoryAsync(CancellationToken) |
异步删除标记为删除的事务。 |
![受保护的方法 受保护的方法](images/ee705318.protmethod(vs.113).gif) |
PruneTransactionHistoryAsync(Boolean, Boolean, CancellationToken) |
如果标记为删除的事务的数目超出 PruningLimit,则删除这些事务。 |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
RolledBack |
停止跟踪回滚的事务。 (重写 TransactionHandler.RolledBack(DbTransaction, DbTransactionInterceptionContext)。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
RollingBack |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
ServerVersionGetting |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
ServerVersionGot |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
StateGetting |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
StateGot |
可在派生类中实现。 (继承自 TransactionHandler。) |
![公共方法 公共方法](images/dn221654.pubmethod(vs.113).gif) |
ToString |
(继承自 Object。) |
顶部
备注
此事务处理程序使用 TransactionContext 存储架构所使用的事务信息,可以通过创建从重写 OnModelCreating(DbModelBuilder) 的 TransactionContext 派生的类并将其传递到此类的构造函数来配置此信息。
线程安全
此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。
请参阅
参考
System.Data.Entity.Infrastructure 命名空间