public void UsingTransactionScope() { using (new TransactionScope()) { new SSAFEntity("example").Save(); //Assert.AreEqual(1, SSAFEntity.FindAll().Length); } using (new SessionScope()) Assert.AreEqual(1, SSAFEntity.FindAll().Count()); }
public void UsingNoFlushSessionScope() { using (new SessionScope(FlushAction.Never)) { new SSAFEntity("example").Save(); Assert.AreEqual(0, SSAFEntity.FindAll().Count()); } using (new SessionScope()) Assert.AreEqual(0, SSAFEntity.FindAll().Count()); }
public void ActiveRecordUsingTransactionScope() { InitModel(); using (new TransactionScope()) { new SSAFEntity("example").Save(); //Assert.AreEqual(1, SSAFEntity.FindAll().Length); } Assert.AreEqual(1, SSAFEntity.FindAll().Length); }
public void UsingSessionScope() { using (new SessionScope()) { new SSAFEntity("example").Save(); Assert.AreEqual(1, SSAFEntity.FindAll().Count()); } using (new SessionScope()) Assert.AreEqual(1, SSAFEntity.FindAll().Count()); }
public void ActiveRecordUsingNoFlushSessionScope() { InitModel(); using (new SessionScope(FlushAction.Never)) { new SSAFEntity("example").Save(); Assert.AreEqual(0, SSAFEntity.FindAll().Length); } Assert.AreEqual(0, SSAFEntity.FindAll().Length); }
public void UsingTransactionScopeWithRollback() { using (TransactionScope scope = new TransactionScope()) { new SSAFEntity("example").Save(); //Assert.AreEqual(1, SSAFEntity.FindAll().Length); scope.VoteRollBack(); } using (new SessionScope()) Assert.AreEqual(0, SSAFEntity.FindAll().Count()); }
public void UsingSessionScopeUsingExplicitFlush() { using (var scope = new SessionScope()) { new SSAFEntity("example").Save(); scope.Flush(); Assert.AreEqual(1, SSAFEntity.FindAll().Count()); } using (new SessionScope()) Assert.AreEqual(1, SSAFEntity.FindAll().Count()); }
public void ActiveRecordUsingTransactionScopeWithRollback() { InitModel(); using (TransactionScope scope = new TransactionScope()) { new SSAFEntity("example").Save(); //Assert.AreEqual(1, SSAFEntity.FindAll().Length); scope.VoteRollBack(); } Assert.AreEqual(0, SSAFEntity.FindAll().Length); }
public void ActiveRecordUsingSessionScopeUsingExplicitFlush() { InitModel(); using (new SessionScope()) { new SSAFEntity("example").Save(); SessionScope.Current.Flush(); Assert.AreEqual(1, SSAFEntity.FindAll().Length); } Assert.AreEqual(1, SSAFEntity.FindAll().Length); }
public void UsingTransactionScopeWithCommitAndInnerSessionScope() { using (TransactionScope scope = new TransactionScope()) { using (new SessionScope()) { new SSAFEntity("example").Save(); Assert.AreEqual(1, SSAFEntity.FindAll().Count()); } //Assert.AreEqual(1, SSAFEntity.FindAll().Length); scope.VoteCommit(); } using (new SessionScope()) Assert.AreEqual(1, SSAFEntity.FindAll().Count()); }
public void UsingNestedTransactionScopesWithRollback() { using (TransactionScope scope = new TransactionScope()) { using (new TransactionScope(TransactionMode.Inherits)) { new SSAFEntity("example").Save(); Assert.AreEqual(1, SSAFEntity.FindAll().Count()); } Assert.AreEqual(1, SSAFEntity.FindAll().Count()); scope.VoteRollBack(); } using (new SessionScope()) Assert.AreEqual(0, SSAFEntity.FindAll().Count()); }