Пример #1
0
        public void GetProductsByCategoryId()
        {
            //IQuery query = UnitOfWork.CurrentSession.GetNamedQuery("GetProductsByCategoryId");
            // query.SetInt32("CategoryId", 1);

            var query = UnitOfWork.CurrentSession.GetNamedQuery("GetProductsByCategoryId", new NHParameter("CategoryId", 1));

            var products = query.List <Product>();

            foreach (var product in products)
            {
                Console.WriteLine(ReflectionTool.ObjectToString(product, true));
                Console.WriteLine("\t Category: " + product.Category.Name);
                Console.WriteLine("\t SuppliedBy: " + product.SuppliedBy.ContactTitle);
            }
        }