本文整理汇总了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));
}
}
示例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();
}
}
}
示例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();
}
}
示例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();
}
}
示例5: CloseSymmetricKey
private static void CloseSymmetricKey(IDbConnection dbConnection, ITransaction txn)
{
using (var dbCommand = dbConnection.CreateCommand())
{
txn.Enlist(dbCommand);
dbCommand.CommandText = closeSymmetricKey;
dbCommand.ExecuteNonQuery();
}
}
示例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));
}
}