示例#1
0
        public void loginAccount(Guid accountId)
        {
            SequentialTransactionManager sequentialTransactionManager = new SequentialTransactionManager();

            sequentialTransactionManager.EnlistmentNotificationCollection.Add(new LoginTransactionTask());
            sequentialTransactionManager.setContextValue(accountId);
            sequentialTransactionManager.setContextValue(DateTime.Now);
            //sequentialTransactionManager.setContextValue("accountId", accountId);
            //sequentialTransactionManager.setContextValue("loginDateTime", DateTime.Now);
            using (TransactionScope transactionScope = new TransactionScope())
            {
                sequentialTransactionManager.enlistVolatile();
                transactionScope.Complete();
            }
        }
示例#2
0
 public static void setContextValue <T>(this SequentialTransactionManager sequentialTransactionManager, T value)
 {
     sequentialTransactionManager.setContextValue(value.GetType().FullName, value);
 }