Beispiel #1
0
		public void Bug()
		{
			using (ISession session = OpenSession())
			{
				ITransaction transaction = session.BeginTransaction();

				Blog blog = new Blog();
				blog.Name = "Test Blog 1";

				Entry entry = new Entry();
				entry.Subject = "Test Entry 1";

				blog.AddEntry(entry);

				session.SaveOrUpdate(blog);

				transaction.Commit();
			}
			using (ISession session = OpenSession())
			{
				ITransaction transaction = session.BeginTransaction();
				session.Delete("from Blog");
				transaction.Commit();
			}
		}
Beispiel #2
0
		public void AddEntry(Entry entry)
		{
			if (entries == null)
			{
				entries = new List<Entry>();
			}
			entry.Blog = this;
			entries.Add(entry);
		}