插图
// Op1: logonUserOperationBehavior(TransactionScoperequired = true)]public bool logonUser(String username,String password){ // AuditWriteProxy declaration and instantiation var valID = false; /* ValIDation logic */ // If valIDation Failed if(!valID) { // Invoke an op in an Audit Service. // Op2 = AuditService.Write // **MUST NOT BE RolLED BACK EVEN AFTER WE [throw]** AuditServiceProxy.Write("Authentication Failed for user " + username); throw new FaultException<AuthenticationFault>("ValIDation Failed"); // After throw,we expect everything transactional to rollback } AuditServiceProxy.Write("User " + username + " authenticated successfully"); return true;}
笔记:
> AuditService.Write *** 作使用msmq绑定并且是单向的
>我在AuditService.Write *** 作合同上尝试了TransactionFlowOption.NotAllowed,在实现上尝试了TransactionScoperequired = false.
using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Suppress)) { AuditServiceProxy.Write("Authentication Failed for user " + username); }
或将此抑制代码放入NonTransactionalLoggingService方法调用中
总结以上是内存溢出为你收集整理的c# – 从事务中排除 *** 作全部内容,希望文章能够帮你解决c# – 从事务中排除 *** 作所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)