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


C# IGenericRepository.Get方法代码示例

本文整理汇总了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());
        }
开发者ID:InnovateEDUNYC,项目名称:NGLV1,代码行数:18,代码来源:ValidatorTests.cs

示例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);
        }
开发者ID:InnovateEDUNYC,项目名称:NGLV1,代码行数:22,代码来源:CreateModelToAssessmentSectionMapperTests.cs

示例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;
            }
        }
开发者ID:rabbal,项目名称:AspNetWebForms-Forum,代码行数:14,代码来源:PublicProfile.aspx.cs

示例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);
        }
开发者ID:InnovateEDUNYC,项目名称:NGLV1,代码行数:24,代码来源:CreateModelToAssessmentMapperTests.cs

示例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);
        }
开发者ID:InnovateEDUNYC,项目名称:NGLV1,代码行数:15,代码来源:CreateModelToAssessmentPerformanceLevelMapperTests.cs

示例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);


        }
开发者ID:InnovateEDUNYC,项目名称:NGLV1,代码行数:16,代码来源:CreateModelToSectionMapperTests.cs

示例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);
            }
        }
开发者ID:rabbal,项目名称:AspNetWebForms-Forum,代码行数:21,代码来源:PublicProfile.aspx.cs

示例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;
         }
     }
 }
开发者ID:rabbal,项目名称:AspNetWebForms-Forum,代码行数:15,代码来源:PublicProfile.aspx.cs


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