当前位置: 首页>>代码示例>>C#>>正文


C# ITransaction.Enlist方法代码示例

本文整理汇总了C#中ITransaction.Enlist方法的典型用法代码示例。如果您正苦于以下问题:C# ITransaction.Enlist方法的具体用法?C# ITransaction.Enlist怎么用?C# ITransaction.Enlist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITransaction的用法示例。


在下文中一共展示了ITransaction.Enlist方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnNewTransaction

 private void OnNewTransaction(ITransaction transaction, TransactionMode transactionMode, IsolationMode isolationMode, bool distributedTransaction)
 {
     if (!transaction.DistributedTransaction)
     {
         transaction.Enlist(new RhinoTransactionResourceAdapter(transactionMode));
     }
 }
开发者ID:JackWangCUMT,项目名称:rhino-tools,代码行数:7,代码来源:RhinoTransactionFacility.cs

示例2: LogEvent

        public static void LogEvent(IDbConnection connection, ITransaction transaction,
                                   string entityClass, int entityKey, string eventName, string userName,
                                   string[] propertyNames, object[] previousState, object[] currentState)
        {
            // AuditLogEntries
            if (insertEntryCommand.Connection != connection)
                insertEntryCommand.Connection = connection;
            if (transaction != null)
                transaction.Enlist(insertEntryCommand);

            ((IDbDataParameter)insertEntryCommand.Parameters[0]).Value = entityClass;
            ((IDbDataParameter)insertEntryCommand.Parameters[1]).Value = entityKey;
            ((IDbDataParameter)insertEntryCommand.Parameters[2]).Value = DateTime.Now;
            ((IDbDataParameter)insertEntryCommand.Parameters[3]).Value = eventName;
            ((IDbDataParameter)insertEntryCommand.Parameters[4]).Value = userName;

            int auditLogEntryId = Convert.ToInt32((decimal)insertEntryCommand.ExecuteScalar());

            // AuditLogEntryLines
            if (insertEntryLineCommand.Connection != connection)
                insertEntryLineCommand.Connection = connection;
            if (transaction != null)
                transaction.Enlist(insertEntryLineCommand);

            if (propertyNames != null)
                for (int i = 0; i < propertyNames.Length; i++)
                    if ((previousState == null || !(previousState[i] is ICollection)) &&
                        (currentState == null || !(currentState[i] is ICollection)))
                    {
                        string previousStateString = (previousState != null ? getPropertyValue(previousState[i]) : "");
                        string currentStateString = (currentState != null ? getPropertyValue(currentState[i]) : "");

                        if (previousStateString != currentStateString)
                        {
                            ((IDbDataParameter)insertEntryLineCommand.Parameters[0]).Value = auditLogEntryId;
                            ((IDbDataParameter)insertEntryLineCommand.Parameters[1]).Value = propertyNames[i];
                            ((IDbDataParameter)insertEntryLineCommand.Parameters[2]).Value = previousStateString;
                            ((IDbDataParameter)insertEntryLineCommand.Parameters[3]).Value = currentStateString;

                            insertEntryLineCommand.ExecuteNonQuery();
                        }
                    }
        }
开发者ID:kiquenet,项目名称:B4F,代码行数:43,代码来源:AuditLog.cs

示例3: ExecuteStatement

 public int ExecuteStatement(ISession session, ITransaction transaction, string sql)
 {
     using (IDbCommand cmd = session.Connection.CreateCommand())
     {
         cmd.CommandText = sql;
         if (transaction != null)
             transaction.Enlist(cmd);
         return cmd.ExecuteNonQuery();
     }
 }
开发者ID:snbbgyth,项目名称:WorkFlowEngine,代码行数:10,代码来源:TestCase.cs

示例4: OpenSymmetricKey

 private static void OpenSymmetricKey(IDbConnection dbConnection, ITransaction txn)
 {
     using (var dbCommand = dbConnection.CreateCommand())
     {
         txn.Enlist(dbCommand);
         dbCommand.CommandText = String.Format(openSymmetricKey, "[email protected][email protected]@l!l");
         dbCommand.ExecuteNonQuery();
     }
 }
开发者ID:Kallivayalil,项目名称:KallivayalilNew,代码行数:9,代码来源:LoginRepository.cs

示例5: CloseSymmetricKey

 private static void CloseSymmetricKey(IDbConnection dbConnection, ITransaction txn)
 {
     using (var dbCommand = dbConnection.CreateCommand())
     {
         txn.Enlist(dbCommand);
         dbCommand.CommandText = closeSymmetricKey;
         dbCommand.ExecuteNonQuery();
     }
 }
开发者ID:Kallivayalil,项目名称:KallivayalilNew,代码行数:9,代码来源:LoginRepository.cs

示例6: OnNewTransaction

		private void OnNewTransaction(ITransaction transaction, TransactionMode transactionMode, IsolationMode isolationMode, bool distributedTransaction)
		{
			//if (!transaction.Context.Contains(ContextKey))
			{
				IObjectContainer db4oContainer = (IObjectContainer) Kernel[typeof(IObjectContainer)];

				transaction.Context[ContextKey] = true;
				transaction.Enlist(new ResourceObjectContainerAdapter(db4oContainer));
			}
		}
开发者ID:nats,项目名称:castle-1.0.3-mono,代码行数:10,代码来源:Db4oFacility.cs


注:本文中的ITransaction.Enlist方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。