Advertisement
Guest User

Untitled

a guest
Mar 4th, 2015
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. using (TransactionScope scope = new TransactionScope())
  2. {
  3. ISession session = sessionFactory.OpenSession();
  4. MappedEntity entity = new MappedEntity() { Name = "Entity", Value = 20 };
  5. session.Save(entity);
  6.  
  7. entity.Value = 30;
  8. session.SaveOrUpdate(entity);
  9.  
  10. // This returns one entity, when it should return none
  11. var list = session.
  12. CreateQuery("from MappedEntity where Value = 20").
  13. List<MappedEntity>();
  14. }
  15.  
  16. using (TransactionScope scope = new TransactionScope())
  17. using (ISession session = sessionFactory.OpenSession())
  18. using (ITransaction transaction = session.BeginTransaction())
  19. {
  20. //Do work here
  21. transaction.Commit();
  22. scope.Complete();
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement