Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using NHibernate.Cfg;
- using Eg.Core.Entities;
- namespace AppPerSession
- {
- class Program
- {
- static void Main(string[] args)
- {
- var nhConfig = new Configuration().Configure();
- var sessionFactory = nhConfig.BuildSessionFactory();
- Console.WriteLine("Configured!");
- using (var openSession = sessionFactory.OpenSession())
- {
- using (var tr = openSession.BeginTransaction())
- {
- IEnumerable<Book> bookList = openSession.QueryOver<Book>().List<Book>();
- foreach (var book in bookList)
- {
- Console.WriteLine(book.Name);
- Console.WriteLine();
- }
- tr.Commit();
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement