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


C# ICategoryRepository.GetAll方法代码示例

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


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

示例1: CategoryPresenter

 public CategoryPresenter(ICategoryView view, CategoryModel model)
 {
     _view = view;
     _model = model;
     _categoryRepository = _model.CategoryRepository;
     _categories = new BindingList<Category>(_categoryRepository.GetAll().ToList());
 }
开发者ID:Mechtatel-student,项目名称:CS1_Project,代码行数:7,代码来源:CategoryPresenter.cs

示例2: ProductPresenter

 public ProductPresenter(IProductView view, ProductModel model)
 {
     _view = view;
     _model = model;
     _categoryRepository = _model.CategoryRepository;
     InitializeProductFields();
     _categories = new BindingList<Category>(_categoryRepository.GetAll().ToList());
 }
开发者ID:Mechtatel-student,项目名称:CS1_Project,代码行数:8,代码来源:ProductPresenter.cs

示例3: ProductListPresenter

 public ProductListPresenter(IProductListView view, ProductListModel model)
 {
     _view = view;
     _model = model;
     _productRepository = _model.ProductRepository;
     _categoryRepository = _model.CategoryRepository;
     CategoriesList = new List<Category>(_categoryRepository.GetAll().ToList());
 }
开发者ID:Mechtatel-student,项目名称:CS1_Project,代码行数:8,代码来源:ProductListPresenter.cs

示例4: Main

        static void Main(string[] args)
        {
            IKernel kernel = new StandardKernel();

            kernel.Bind<IShipperRepository>().To<Data.ShipperRepository>().WithConstructorArgument("connectionString", "DataSource=xxx");
            kernel.Bind<ICategoryRepository>().To<Data.CategoryRepository>();
            kernel.Bind<IProductRepository>().To<Data.ProductRepository>();

            //are these needed???
            /*
            kernel.Bind<IShipper>().To<Entities.Shipper>();
            kernel.Bind<ICategory>().To<Entities.Category>();    
            kernel.Bind<IProduct>().To<Entities.Product>();    
            */

            shipperRepository = kernel.Get<IShipperRepository>();
            categoryRepository = kernel.Get<ICategoryRepository>();
            productRepository = kernel.Get<IProductRepository>();
            
            System.Console.WriteLine("Connection String: {0}", shipperRepository.ToString());

            #region MAPS STUFF
            /*
            // SIMPLE QUERY
            foreach(var item in organisationRepository.GetAllOrganisations())
            {
                System.Console.WriteLine("OrgId: {0} ¦ OrgName: {1} ¦ Phone: {2}", item.OrganisationId, item.OrganisationName, item.Phone);
            }         

            // SIMPLE JOIN QUERY WITH PARAMETER
            foreach (var item in organisationRepository.GetAllOrganisationsInGroupId(474))
            {
                System.Console.WriteLine("OrgId: {0} ¦ OrgName: {1} ¦ Phone: {2}", item.OrganisationId, item.OrganisationName, item.Phone);
            }

            // SIMPLE QUERY USING EMBEDDED SQL RESOURCE
            foreach (var item in personRepository.GetAllPeople())
            {
                System.Console.WriteLine("PersonId: {0} ¦ LastName: {1} ¦ FirstName: {2} ¦ Phone: {3}", item.PersonId, item.LastName, item.FirstName, item.MobilePhone);
            }

            // SIMPLE QUERY USING STORED PROC
            foreach (var item in titleRepository.GetAllTitles())
            {
                System.Console.WriteLine("TitleId: {0} ¦ Desc: {1}", item.TitleID, item.TitleDesc);
            }

            // MULTIPLE QUERIES RESULTS
            var org = organisationRepository.GetOrganisationWithGroups(448);
            if (org != null)
            {
                System.Console.WriteLine("OrgId: {0} ¦ OrgName: {1} ¦ Phone: {2}", org.OrganisationId, org.OrganisationName, org.Phone);
                foreach (var grp in org.Groups)
                {
                    System.Console.WriteLine("GroupId: {0} ¦ Desc: {1}", grp.GroupID, grp.GroupDesc);
                }
            }

            // MULTI MAPPING QUERY WITH PARAMETER (a single row to multiple objects)
            var person = personRepository.GetPersonWithOrganisation(3348);
            if (person != null)
            {
                System.Console.WriteLine("PersonId: {0} ¦ LastName: {1} ¦ FirstName: {2}", person.PersonId, person.LastName, person.FirstName);
            }

            // INSERT ITEM QUERY
            MyDapperDemo.Entities.MAPS.Organisation newOrg = new Entities.MAPS.Organisation
            {
                OrganisationName = "Barrys Bits",
                Phone = "555 551155"
            };
            int rowsAffected = organisationRepository.AddOrganisation2(newOrg);
            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]"
            };

//.........这里部分代码省略.........
开发者ID:BarryBurke,项目名称:MyDapperDemo,代码行数:101,代码来源:Program.cs


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