当前位置: 首页>>代码示例>>C#>>正文


C# IProductRepository.GetAllWithCategory方法代码示例

本文整理汇总了C#中IProductRepository.GetAllWithCategory方法的典型用法代码示例。如果您正苦于以下问题:C# IProductRepository.GetAllWithCategory方法的具体用法?C# IProductRepository.GetAllWithCategory怎么用?C# IProductRepository.GetAllWithCategory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IProductRepository的用法示例。


在下文中一共展示了IProductRepository.GetAllWithCategory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main


//.........这里部分代码省略.........
            System.Console.WriteLine("Rows affected: {0}", rowsAffected);
            System.Console.WriteLine("NewId: {0}", org.OrganisationId);

            foreach (var item in organisationRepository.GetAllOrganisations())
            {
                System.Console.WriteLine("OrgId: {0} ¦ OrgName: {1} ¦ Phone: {2}", item.OrganisationId, item.OrganisationName, item.Phone);
            }

            // QUERY WITH DYNAMIC RESULT
            dynamic bankaccs = organisationRepository.GetAllBankAccounts();
            foreach (var item in bankaccs)
            {
                System.Console.WriteLine("AccName: {0}", item.BankAccountName);
            }

            
            */

            /*

            MyDapperDemo.Entities.MAPS.Person p = new Entities.MAPS.Person
            {
                FirstName = "Hoof",
                LastName = "Hearted",
                MobilePhone = "021 5553332",
                DirectEmail = "[email protected]"
            };

            int rowsAffected = personRepository.AddPerson(p);
            System.Console.WriteLine("Rows affected: {0}", rowsAffected);
            System.Console.WriteLine("NewId: {0}", p.PersonId);

            foreach (var item in personRepository.GetAllPeople())
            {
                System.Console.WriteLine("PersonId: {0} ¦ LastName: {1} ¦ FirstName: {2}", item.PersonId, item.LastName, item.FirstName);
            }
             
              foreach (var item in groupRepository.GetAllGroups())
            {
                System.Console.WriteLine("GroupId: {0} ¦ Desc: {1}", item.GroupID, item.GroupDesc);
            }

            */
            #endregion

            PrintAllShippers(shipperRepository.GetAll());
            
            AddShipper("Barrys Bits");
            //System.Console.ReadLine();
            
            PrintAllShippers(shipperRepository.GetAll());
           
            //EditShipper(4, "Bobs Bits");
            EditShipper("Barrys Bits", "Bobs Bits");
            //System.Console.ReadLine();
            
            PrintAllShippers(shipperRepository.GetAll());

            DeleteShipper(shipperRepository.GetShipperByName("Bobs Bits").ShipperId);
            //System.Console.ReadLine();

            PrintAllShippers(shipperRepository.GetAll());
            
            System.Console.WriteLine("CATEGORIES");
            foreach (var item in categoryRepository.GetAll())
            {
                System.Console.WriteLine("CategoryId: {0} ¦ CategoryName: {1} ¦ Desc: {2} ¦ PicSize: {3}", item.CategoryId, item.CategoryName, item.Description, item.Picture.Length);
            }
            System.Console.ReadLine();

            System.Console.WriteLine("\n\nPRODUCTS");
            foreach (var item in productRepository.GetAll())
            {
                System.Console.WriteLine("ProductId: {0} ¦ SupplierId: {1} ¦ ProductName: {2}", item.ProductId, item.SupplierId, item.ProductName);
            }
            System.Console.ReadLine();

            System.Console.WriteLine("\n\nPRODUCTS WITH CATEGORIES");
            foreach (var item in productRepository.GetAllWithCategory())
            {
                System.Console.WriteLine("ProductId: {0} ¦ SupplierId: {1} ¦ ProductName: {2} ¦ CategoryName: {3}", item.ProductId, item.SupplierId, item.ProductName, item.Category.CategoryName);
            }
            System.Console.ReadLine();

            //System.Console.WriteLine("\n\nDYNAMIC");
            //foreach (var undefinedType in dynamicRepository.GetAllCategories())
            //{
            //    System.Console.WriteLine("CategoryId: {0} ¦ CategoryName: {1} ¦ Desc: {2}", undefinedType.CategoryId, undefinedType.CategoryName, undefinedType.Description);
            //}

            //System.Console.WriteLine("Number of Products: {0}", basicRepository.GetNumberOfProducts());

            //STORED PROC SUPPORT
            //TRANSACTION SUPPORT

            //EXTENSION SUPPORT FOR ASYNC METHODS
            //

            System.Console.ReadLine();
        }
开发者ID:BarryBurke,项目名称:MyDapperDemo,代码行数:101,代码来源:Program.cs


注:本文中的IProductRepository.GetAllWithCategory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。