public void CustomPersister()
		{
			ISession s = OpenSession();
			Custom c = new Custom();
			c.Name = "foo";
			c.Id = "100";
			string id = (string)s.Save(c);
			Assert.AreSame(c, s.Load(typeof(Custom), id));
			s.Flush();
			s.Close();

			s = OpenSession();
			c = (Custom) s.Load(typeof(Custom), id);
			Assert.AreEqual("foo", c.Name);
			c.Name = "bar";
			s.Flush();
			s.Close();

			s = OpenSession();
			c = (Custom) s.Load(typeof(Custom), id);
			Assert.AreEqual("bar", c.Name);
			s.Delete(c);
			s.Flush();
			s.Close();

			s = OpenSession();
			bool none = false;
			try
			{
				s.Load(typeof(Custom), id);
			}
			catch (ObjectNotFoundException onfe)
			{
				Assert.IsNotNull(onfe); //getting ride of 'onfe' is never used compile warning
				none = true;
			}

			Assert.IsTrue(none);
			s.Close();
		}
		public object Instantiate(object id, EntityMode entityMode)
		{
			CheckEntityMode(entityMode);
			Custom c = new Custom();
			c.Id = (string)id;
			return c;
		}
		public object Instantiate(object id)
		{
			Custom c = new Custom();
			c.Id = (long)id;
			return c;
		}
示例#4
0
        public object[] GetPropertyValues(object obj)
        {
            Custom c = (Custom)obj;

            return(new Object[] { c.Name });
        }