public void QueryingWorksWithDetachedCriteria() { using (new SessionScope()) CreateLazyBlog(); var crit = DetachedCriteria.For <Blog>().Add(Expression.Eq("Author", "Mort")); using (new StatelessSessionScope()) Assert.AreEqual(1, AR.FindAll <Blog>(crit).Count()); }
public void OperateTheOtherOne() { using (new SessionScope()) { var authors = AR.FindAll <Author>().ToArray(); Assert.AreEqual(0, authors.Length); CreateAuthor(); } using (var scope = new SessionScope()) { Assert.AreEqual(1, scope.Count <Author>()); } }
public void OperateOne() { using (new SessionScope()) { var blogs = AR.FindAll <Blog>().ToArray(); Assert.AreEqual(0, blogs.Length); CreateBlog(); } using (new SessionScope()) { var blogs = AR.FindAll <Blog>().ToArray(); Assert.AreEqual(1, blogs.Length); } }
public void SessionsAreDifferent() { using (new SessionScope()) { var blog = new Blog(); var author = new Author(); AR.FindAll <Blog>(); AR.FindAll <Author>(); Assert.AreNotSame(blog.GetCurrentSession(), author.GetCurrentSession()); Assert.AreNotEqual( blog.GetCurrentSession().Connection.ConnectionString, author.GetCurrentSession().Connection.ConnectionString); } }