Esempio n. 1
0
        public void EnsureTransactionIsCreatedDependingOnParentTransactionScope()
        {
            IDriver driver = new SqlServer();
            driver.Initialize("Data Source=EUSS;Initial Catalog=uss2;Integrated Security=true");
            IDbConnection connection = driver.CreateConnection();
            connection.Open();
            IDbTransaction transaction = connection.BeginTransaction();
            Assert.AreEqual(System.Data.IsolationLevel.ReadCommitted, transaction.IsolationLevel);
            transaction.Rollback();

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions() { IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted }))
            {
                transaction = driver.BeginTransaction(connection);
                Assert.AreEqual(System.Data.IsolationLevel.ReadUncommitted, transaction.IsolationLevel);
                transaction.Rollback();
            }

            using (TransactionScope scope1 = new TransactionScope(TransactionScopeOption.RequiresNew, new TransactionOptions() { IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted }))
            {
                using (TransactionScope scope2 = new TransactionScope(TransactionScopeOption.RequiresNew, new TransactionOptions() { IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted }))
                {
                    transaction = driver.BeginTransaction(connection);
                    Assert.AreEqual(System.Data.IsolationLevel.ReadUncommitted, transaction.IsolationLevel);
                    transaction.Rollback();
                }
            }

            connection.Close();
        }
Esempio n. 2
0
 public SqlMapperProvider()
 {
     Driver = new Drivers.SqlServer();
     Dialect = new Dialects.SqlServer();
     //this.TypeResolver = new TypeResolver.TypeResolverImpl();
     this.Serializer = new Serializer.BinarySerializer();
 }