本文整理汇总了C#中IGenericRepository.Get方法的典型用法代码示例。如果您正苦于以下问题:C# IGenericRepository.Get方法的具体用法?C# IGenericRepository.Get怎么用?C# IGenericRepository.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGenericRepository
的用法示例。
在下文中一共展示了IGenericRepository.Get方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Setup
private void Setup()
{
_genericRepository = Substitute.For<IGenericRepository>();
_sectionCreateModel = new CreateSectionModelBuilder().Build();
_validator = new CreateModelValidator(_genericRepository);
_genericRepository.Get(Arg.Any<Expression<Func<Web.Data.Entities.Session, bool>>>())
.Returns(new SessionBuilder().Build());
_genericRepository.Get(Arg.Any<Expression<Func<Web.Data.Entities.ClassPeriod, bool>>>())
.Returns(new ClassPeriodBuilder().Build());
_genericRepository.Get(Arg.Any<Expression<Func<Web.Data.Entities.Location, bool>>>())
.Returns(new LocationBuilder().Build());
_genericRepository.Get(Arg.Any<Expression<Func<Web.Data.Entities.Course, bool>>>())
.Returns(new CourseBuilder().Build());
}
示例2: SetUp
private void SetUp()
{
_createModel = new CreateAssessmentModelBuilder().Build();
_assessment = new AssessmentBuilder()
.WithAssessmentLearningStandards()
.WithAssessmentPerformanceLevels()
.Build();
_genericRepositoryStub = Substitute.For<IGenericRepository>();
_section = new SectionBuilder().Build();
var fourthGradeLevelDescriptor = new GradeLevelDescriptor
{
GradeLevelDescriptorId = 99,
GradeLevelTypeId = 100
};
_genericRepositoryStub.Get(Arg.Any<GradeLevelTypeDescriptorQuery>()).Returns( fourthGradeLevelDescriptor);
_genericRepositoryStub.Get(Arg.Any<Expression<Func<Web.Data.Entities.Section, bool>>>())
.Returns(_section);
}
示例3: GetItem
public User GetItem()
{
if (!User.Identity.IsAuthenticated) return null;
var id = long.Parse(User.Identity.GetUserId());
_useRepository = new UserRepository();
using (_useRepository)
{
var user=_useRepository.Get(id);
if (user != null) return user;
Response.Error404();
return null;
}
}
示例4: SetUp
private void SetUp()
{
_genericRepositoryStub = Substitute.For<IGenericRepository>();
_createModelToAssessmentPerformanceLevelMapperMock = Substitute.For<IPerformanceLevelMapper>();
_createModelToCreateModelToAssessmentSectionMapperMock = Substitute.For<ICreateModelToAssessmentSectionMapper>();
_createModelToCreateModelToAssessmentLearningStandardMapperMock =
Substitute.For<ICreateModelToAssessmentLearningStandardMapper>();
_section = new SectionBuilder().Build();
_course = new CourseBuilder().Build();
_4ThGradeLevelDescriptor = new GradeLevelDescriptor
{
GradeLevelDescriptorId = 99,
GradeLevelTypeId = 100
};
_genericRepositoryStub.Get(Arg.Any<GradeLevelTypeDescriptorQuery>())
.Returns(_4ThGradeLevelDescriptor);
_genericRepositoryStub.Get(Arg.Any<Expression<Func<Web.Data.Entities.Section, bool>>>())
.Returns(_section);
_genericRepositoryStub.Get(Arg.Any<Expression<Func<Web.Data.Entities.Course, bool>>>())
.Returns(_course);
}
示例5: SetUp
private void SetUp()
{
_createModel = new CreateAssessmentModelBuilder().Build();
_assessment = new AssessmentBuilder().Build();
_genericRepositoryStub = Substitute.For<IGenericRepository>();
var fourthGradeLevelDescriptor = new GradeLevelDescriptor
{
GradeLevelDescriptorId = 99,
GradeLevelTypeId = 100
};
_genericRepositoryStub.Get(Arg.Any<GradeLevelTypeDescriptorQuery>())
.Returns(fourthGradeLevelDescriptor);
}
示例6: Setup
private void Setup()
{
_schoolRepository = Substitute.For<ISchoolRepository>();
_schoolRepository.GetSchool().Returns(new School
{
SchoolId = Constants.SchoolId,
EducationOrganization = new EducationOrganization {EducationOrganizationId = 1}
});
_session = new SessionBuilder().Build();
_genericRepository = Substitute.For<IGenericRepository>();
_genericRepository.Get(Arg.Any<Expression<Func<Web.Data.Entities.Session, bool>>>()).Returns(_session);
}
示例7: EditItem
public void EditItem(long id)
{
_useRepository = new UserRepository();
using (_useRepository)
{
var item = _useRepository.Get(id);
if (item == null)
{
Response.Error404();
return;
}
TryUpdateModel(item);
if (!ModelState.IsValid) return;
// Save changes here
_useRepository.Update(item);
Response.RedirectPermanent(Request.Url.AbsoluteUri);
}
}
示例8: GetUserWallImage
public string GetUserWallImage()
{
var id = long.Parse(RouteData.Values["id"].ToString());
_useRepository = new UserRepository();
using (_useRepository)
{
using (_useRepository)
{
var user = _useRepository.Get(id);
if (user != null) return "/Images/Users/Walls/"+user.WallImage;
Response.Error404();
return string.Empty;
}
}
}