Example #1
0
        public void UpdateConflictTest()
        {
#if NETFX
            using (new TransactionHelper())
            {
                Concurrency.DatabaseWins(new DbReaderWriter(new AdventureWorks()), new DbReaderWriter(new AdventureWorks()), new DbReaderWriter(new AdventureWorks()));
            }
            using (new TransactionHelper())
            {
                Concurrency.ClientWins(new DbReaderWriter(new AdventureWorks()), new DbReaderWriter(new AdventureWorks()), new DbReaderWriter(new AdventureWorks()));
            }
            using (new TransactionHelper())
            {
                Concurrency.MergeClientAndDatabase(new DbReaderWriter(new AdventureWorks()), new DbReaderWriter(new AdventureWorks()), new DbReaderWriter(new AdventureWorks()));
            }
            using (new TransactionHelper())
            {
                Concurrency.SaveChanges(new AdventureWorks(), new AdventureWorks());
            }
#else
            Rollback((adventureWorks1, adventureWorks2, adventureWorks3) =>
                     Concurrency.DatabaseWins(new DbReaderWriter(adventureWorks1), new DbReaderWriter(adventureWorks2), new DbReaderWriter(adventureWorks3)));
            Rollback((adventureWorks1, adventureWorks2, adventureWorks3) =>
                     Concurrency.ClientWins(new DbReaderWriter(adventureWorks1), new DbReaderWriter(adventureWorks2), new DbReaderWriter(adventureWorks3)));
            Rollback((adventureWorks1, adventureWorks2, adventureWorks3) =>
                     Concurrency.MergeClientAndDatabase(new DbReaderWriter(adventureWorks1), new DbReaderWriter(adventureWorks2), new DbReaderWriter(adventureWorks3)));
            Rollback((adventureWorks1, adventureWorks2) =>
                     Concurrency.SaveChanges(adventureWorks1, adventureWorks2));
#endif
        }
Example #2
0
 public void UpdateConflictTest()
 {
     Rollback((adventureWorks1, adventureWorks2, adventureWorks3) =>
              Concurrency.DatabaseWins(new DbReaderWriter(adventureWorks1), new DbReaderWriter(adventureWorks2), new DbReaderWriter(adventureWorks3)));
     Rollback((adventureWorks1, adventureWorks2, adventureWorks3) =>
              Concurrency.ClientWins(new DbReaderWriter(adventureWorks1), new DbReaderWriter(adventureWorks2), new DbReaderWriter(adventureWorks3)));
     Rollback((adventureWorks1, adventureWorks2, adventureWorks3) =>
              Concurrency.MergeClientAndDatabase(new DbReaderWriter(adventureWorks1), new DbReaderWriter(adventureWorks2), new DbReaderWriter(adventureWorks3)));
     Rollback((adventureWorks1, adventureWorks2) =>
              Concurrency.SaveChanges(adventureWorks1, adventureWorks2));
 }
Example #3
0
 public void ConflictTest()
 {
     Concurrency.DefaultControl();
     try
     {
         Concurrency.CheckModifiedDate();
         Assert.Fail();
     }
     catch (ChangeConflictException exception)
     {
         Trace.WriteLine(exception);
     }
     Concurrency.DatabaseWins();
     Concurrency.ClientWins();
     Concurrency.MergeClientAndDatabase();
 }