Ejemplo n.º 1
0
        public void Stateless_GetObject_Tests()
        {
            Assert.IsNull(_session.GetObject <User>(x => x.Name == "test"));

            _session.Insert(new User {
                Name = "test"
            });

            var user = _session.GetObject <User>(x => x.Name == "test");

            Assert.IsNotNull(user);

            user.Name = "foo";
            _session.Update(user);

            user = _session.GetObject <User>(x => x.Name == "foo");
            Assert.IsNotNull(user);

            _session.Delete(user);
            Assert.IsNull(_session.GetObject <User>(x => x.Name == "foo"));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Gets the single object by query.
 /// </summary>
 /// <param name="query">The query.</param>
 /// <returns></returns>
 public T GetSingleByQuery(Expression <Func <T, bool> > query)
 {
     return(Session.GetObject(query));
 }