本文整理汇总了C#中IGenericRepository.GetAll方法的典型用法代码示例。如果您正苦于以下问题:C# IGenericRepository.GetAll方法的具体用法?C# IGenericRepository.GetAll怎么用?C# IGenericRepository.GetAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGenericRepository
的用法示例。
在下文中一共展示了IGenericRepository.GetAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUpGenericRepositoryStub
private void SetUpGenericRepositoryStub()
{
_genericRepository = Substitute.For<IGenericRepository>();
_summer2010 = new Web.Data.Entities.Session
{
SessionName = "Summer 2010",
BeginDate = new DateTime(2010, 6, 1),
EndDate = new DateTime(2010, 8, 30)
};
_fall2010 = new Web.Data.Entities.Session
{
SessionName = "Fall 2010",
BeginDate = new DateTime(2010, 10, 1),
EndDate = new DateTime(2011, 1, 3)
};
_spring2010 = new Web.Data.Entities.Session
{
SessionName = "Spring 2010",
BeginDate = new DateTime(2010, 01, 1),
EndDate = new DateTime(2010, 5, 01)
};
IEnumerable<Web.Data.Entities.Session> sessionList = new List<Web.Data.Entities.Session>
{
_summer2010,
_fall2010,
_spring2010
};
_genericRepository.GetAll<Web.Data.Entities.Session>().Returns(sessionList);
}
示例2: SpeakersController
public SpeakersController(IGenericRepository repository, IFilterSpeakerHelper speakersFilter,
IControllerHelper controllerHelper)
: base(repository)
{
if (speakersFilter == null || controllerHelper == null)
{
throw new ArgumentNullException("Filter or controllerHelper does not exist!");
}
_speakersFilter = speakersFilter;
Speakers = repository.GetAll<Speaker>().ToList();
_controllerHelper = controllerHelper;
}