本文整理汇总了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());
}
示例2: ProductPresenter
public ProductPresenter(IProductView view, ProductModel model)
{
_view = view;
_model = model;
_categoryRepository = _model.CategoryRepository;
InitializeProductFields();
_categories = new BindingList<Category>(_categoryRepository.GetAll().ToList());
}
示例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());
}
示例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]"
};
//.........这里部分代码省略.........