Esempio n. 1
0
        static void Main(string[] args)
        {
            try
            {
                var nHibernateBase = new NHibernateBase();
                nHibernateBase.Initialize("NHibernate.GuitarStore");

                System.Console.WriteLine("NHibernte.GuitarStore assembly initialised.");

                var list1 = NHibernateBase.StatelessSession.CreateCriteria("Inventory").List<Inventory>();
                var list2 = NHibernateBase.Session.CreateCriteria(typeof (Inventory)).List<Inventory>();
                IQueryable<Inventory> linq = NHibernateBase.Session.Query<Inventory>().Select(i => i);

            }
            catch (Exception ex)
            {
                string message = ex.Message;
                if (ex.InnerException != null)
                {
                    message += " - InnerException: " + ex.InnerException.Message;
                }

                System.Console.WriteLine();
                System.Console.WriteLine("***** ERROR *****");
                System.Console.WriteLine(message);
                System.Console.WriteLine();

            }
        }
Esempio n. 2
0
        private static void Main(string[] args)
        {
            try
            {
                var NHB = new NHibernateBase();
                NHB.Initialize("NHibernate.GuitarStore");
                System.Console.WriteLine("NHibernate.GuitarStore assembly initialized.");
                System.Console.ReadLine();

                IList<Inventory> list1 = NHibernateBase.StatelessSession.CreateQuery("from 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);
            }
            catch (Exception ex)
            {
                string Message = ex.Message;
                if (ex.InnerException != null)
                    Message += " - InnerException: " + ex.InnerException.Message;
                System.Console.WriteLine();
                System.Console.WriteLine("***** ERROR *****");
                System.Console.WriteLine(Message);
                System.Console.WriteLine();
                System.Console.ReadLine();
            }
        }
        static void Main(string[] args)
        {
            var hibernateBase = new NHibernateBase();
            hibernateBase.Initialize("NHibernate.GuitarStore");
            Console.WriteLine("NHibernate.GuitarStore assembly initialized.");

            //var inventories = NHibernateBase.Session.CreateCriteria(typeof(Inventory)).List<Inventory>();
            //foreach (var inventory in inventories)
            //{
            //    Console.WriteLine(inventory.Model + ": " + inventory.Price);
            //}
            //var queryable = (from l in NHibernateBase.Session.Query<Inventory>() select l).Skip(10).ToList();
            //foreach (var inventory in queryable)
            //{
            //    Console.WriteLine(inventory.Model + ": " + inventory.Received);
            //}

            try
            {
                var core = new CategoryCore();
                var categories = core.ExecuteICriteria();
                foreach (var category in categories)
                {
                    Console.WriteLine(category.Id + ": " + category.Name);
                }
            }
            catch (Exception err)
            {
                CallError(err);
            }
            //Console.ReadLine();

            try
            {
                var a = new InventoryCore();
                var inventories = a.ExecuteICriteria<Inventory>();
                foreach (var inventory in inventories)
                {
                    Console.WriteLine(inventory.MODEL + ": " + inventory.PRICE);
                }
            }
            catch (Exception err)
            {
                CallError(err);
            }
            Console.WriteLine("End");
            Console.ReadLine();
        }
 public MainWindow()
 {
     InitializeComponent();
     var nhb = new NHibernateBase();
     nhb.Initialize("NHibernate.GuitarStore");
 }
Esempio n. 5
0
        public ProductRepository()
        {
            NHibernateBase nHibernate = new NHibernateBase();

            nHibernate.Initialize();
        }
Esempio n. 6
0
        public OrderRepository()
        {
            NHibernateBase nHibernate = new NHibernateBase();

            nHibernate.Initialize();
        }
Esempio n. 7
0
        public BaseApi()
        {
            NHibernateBase nHibernate = new NHibernateBase();

            nHibernate.Initialize();
        }