コード例 #1
0
        public void ChangesTest()
        {
            ProductCategory category = Changes.Create();

            Changes.Update();
            Changes.SaveNoChanges();
            Changes.UpdateWithoutRead(category.ProductCategoryID);
            Changes.Delete();
            Changes.DeleteWithoutRead(category.ProductCategoryID);
            try
            {
                Changes.DeleteWithAssociation();
                Assert.Fail();
            }
            catch (DbUpdateException exception)
            {
                Trace.WriteLine(exception);
            }
            Changes.DeleteAllAssociated();
            try
            {
                Changes.UntrackedChanges();
                Assert.Fail();
            }
            catch (InvalidOperationException exception)
            {
                Trace.WriteLine(exception);
            }
        }
コード例 #2
0
 public void ChangesTest()
 {
     using (TransactionScope scope = new TransactionScope())
     {
         int subcategoryId = Changes.Create();
         Changes.Update();
         Changes.UpdateWithNoChange();
         Changes.Delete();
         Changes.DeleteWithNoQuery(subcategoryId);
         Changes.DeleteWithAssociation();
         try
         {
             Changes.UntrackedChanges();
             Assert.Fail();
         }
         catch (InvalidOperationException exception)
         {
             Trace.WriteLine(exception);
         }
         scope.Complete();
     }
 }