Пример #1
0
        static void InitlizationTest()
        {
            try
            {
                NHibernateBase nHibernateBase = new NHibernateBase();
                nHibernateBase.Initilize("NHibernate.GuitarStore");
                System.Console.WriteLine("NHibernate.GuitarStore assembly Initialized.");

                System.Console.ReadLine();
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                while (ex.InnerException != null)
                {
                    message += "\r - InnerException: " + ex.InnerException.Message;
                    ex = ex.InnerException;
                }

                System.Console.WriteLine();
                System.Console.WriteLine("***** ERROR *****");
                System.Console.WriteLine(message);
                System.Console.WriteLine();
                System.Console.ReadLine();
            }
        }
Пример #2
0
        public MainWindow()
        {
            InitializeComponent();

            // test to be sure that Nhibernate can load the mapping files.
            NHibernateBase nHibernateBase = new NHibernateBase();
            nHibernateBase.Initilize("NHibernate.GuitarStore");
        }
Пример #3
0
        static void QueriesToBeCalled()
        {
            NHibernateBase nHibernateBase = new NHibernateBase();
            nHibernateBase.Initilize("NHibernate.GuitarStore");
            System.Console.WriteLine("NHibernate.GuitarStore assembly Initialized.");

            IList<Inventory> list1 = NHibernateBase.StatelessSession.CreateCriteria("Inventory").List<Inventory>();

            IList<Inventory> list2 = NHibernateBase.Session.CreateCriteria(typeof (Inventory)).List<Inventory>();

            IQueryable<Inventory> linq =
                (from l in NHibernateBase.Session.Query<Inventory>() select l);
        }