コード例 #1
0
        public IAdoCommand CreateCommand()
        {
            var dbCommand = SqlConnection.CreateCommand();
            var command   = new AdoCommand(dbCommand);

            return(command);
        }
コード例 #2
0
        static void ManageTransactions(AdoCommand command, bool useSingleTransaction, Dictionary <IDbConnection, IDbTransaction> transactions)
        {
            if (!useSingleTransaction)
            {
                return;
            }

            var connection = command.Connection;

            if (connection.State != ConnectionState.Open)
            {
                connection.Open();
            }

            IDbTransaction transaction;

            if (!transactions.ContainsKey(connection))
            {
                transaction = connection.BeginTransaction(IsolationLevel.ReadCommitted);
                transactions.Add(connection, transaction);
            }
            else
            {
                transaction = transactions[connection];
            }

            command.Transaction = transaction;
        }