public void CoreDaoTest()
        {
            FluentNHibernateHelper.Connect();
            CoreDao <Product> dao = new CoreDao <Product>(new SessionProviderFNH());

            dao.Put(new Product {
                Name = "PS2", Description = "VideoConsole"
            });
            dao.Put(new Product {
                Name = "PS3", Description = "VideoConsole"
            });
            IList <Product> products = dao.Get();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            //IDao<Product, int> productDao = new CoreDAO<Product, int>();//null ; // Inject.Get<IDao<Product, int>>
            //productDao.Get(4);

            var newProd = new Product
            {
                Name = "Burger6",
                ProductNumber = "ABC21",
                PriceCost = 1050,
                InvtType = new InventoryType { Id = 1 },
                Supplier = "Coles",
                PriceWholesale = 1300,
                BarCode = "12346436"
            };

            IDao dao = new CoreDao();
            dao.Save(newProd);

            ////IDao dao = null; // Inject.Get<IDao<Product, int>>
            ////dao.Get<Product, int>(4);

            //var allProds = dao.GetAll<Product>();

            //foreach (var prod in allProds) {
            //    System.Console.WriteLine("Product[name:" + prod.Name + "]");
            //}

            //var burger2Product = from p in dao.GetQueryable<Product>()
            //                     where p.Name == "Burger2"
            //                     select p;
            //System.Console.WriteLine("Test queryable ");
            //foreach (var prod in burger2Product)
            //{
            //    System.Console.WriteLine("Product[name:" + prod.Name + "]");
            //}

            //IDao dao = new CoreDAO();

            var p = dao.Get<Product, int>(1);

            dao.Save(p);

            System.Console.WriteLine("************UPDATE PRODUCT 1****************");
            System.Console.WriteLine(p.ToString());
            System.Console.WriteLine("************NEW PRODUCT****************");
            System.Console.WriteLine(newProd.ToString());

            System.Console.Read();
        }
Esempio n. 3
0
 public AppRepository()
 {
     coreDao = new CoreDao();
 }