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


C# IRepository.GetAll方法代码示例

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


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

示例1: DesignRequestListVm

        public DesignRequestListVm(IRepository<Request> requestRepository, IRepository<City> cityRepository, IEventAggregator eventAggregator, NavigationService navigationService)
        {
            _requestRepository = requestRepository;
            _cityRepository = cityRepository;
            _eventAggregator = eventAggregator;
            _navigationService = navigationService;

            Items = new ObservableCollection<RequestVm>(_requestRepository.GetAll().Select(x => new RequestVm(x)));

            _eventAggregator.GetEvent<ChangeAcceptedEvent<Hangar>>().Subscribe(_ =>

            {
                new ObservableCollection<RequestVm>(_requestRepository.GetAll().Select(x => new RequestVm(x)));
            });
        }
开发者ID:ceo1647,项目名称:HangarEstimates,代码行数:15,代码来源:DesignRequestListVm.cs

示例2: Create

		public ActionResult Create(UserInputModel userInputModel)
		{
            _repository = new InMemoryRepository();
            _authenticator = new CookieAuthenticator();

			if (_repository.GetAll<User>().Any(x => x.Username == userInputModel.Username))
			{
				ModelState.AddModelError("Username", "Username is already in use");
			}

			if (ModelState.IsValid)
			{
				var user = new User
				{
					Id = Guid.NewGuid(),
					Username = userInputModel.Username,
					Password = HashPassword(userInputModel.Password),
				};

				_repository.SaveOrUpdate(user);

                _authenticator.SetCookie("72201781859E67D4F633C34381EFE4BC928656AEE324A4B00CADA968ACD6CF33047E47479B0B68050FF4A0DB13688B5C78DAFDF53252A94E7F1D7B58A6FFD95D747F3D3AA761DECA7B6358A2E78B85D868833A9420316BDA8A5A0425D543AC1148CB69B902195C20065446A5E5F7A8E4C94A04A22304680E1211F00A12DF5E8777A343D08D0F8C0A3BFC471381E9B070E0F0608ADAEBCA8E233A21251BF57A03B52C1F03B7169CFC7C98216E7217EA649C4EDBD35E07F11A2444D40BE303BFFA28BAA921CDCC298D09A6E0297ED7D6E8");

				return RedirectToAction("Index", "Home");
			}

			return View("New", userInputModel);
		}
开发者ID:msgavin,项目名称:AppHarbor.Web.Security.NET2,代码行数:28,代码来源:UserController.cs

示例3: EstablishContext

        protected override void EstablishContext()
        {
            schoolMetricTeacherListRepository = mocks.StrictMock<IRepository<SchoolMetricTeacherList>>();
            staffInformationRepository = mocks.StrictMock<IRepository<StaffInformation>>();
            staffEducationOrgInformationRepository = mocks.StrictMock<IRepository<StaffEducationOrgInformation>>();
            footnoteRepository = mocks.StrictMock<IRepository<MetricInstanceFootnote>>();
            uniqueListIdProvider = mocks.StrictMock<IUniqueListIdProvider>();
            metricInstanceSetKeyResolver = mocks.StrictMock<IMetricInstanceSetKeyResolver<SchoolMetricInstanceSetRequest>>();
            metricNodeResolver = mocks.StrictMock<IMetricNodeResolver>();

            suppliedSchoolMetricTeacherList = GetSuppliedSchoolMetricTeacherList();
            suppliedStaffInformationList = GetSuppliedStaffInformationList();
            suppliedStaffEducationOrgInformationList = GetSuppliedStaffEducationOrgInformationList();
            suppliedFootnoteList = GetSuppliedFootnoteList();

            Expect.Call(metricNodeResolver.GetMetricNodeForSchoolFromMetricVariantId(suppliedSchoolId, suppliedMetricVariantId)).Return(GetSuppliedMetricMetadataNode());
            Expect.Call(schoolMetricTeacherListRepository.GetAll()).Repeat.Any().Return(suppliedSchoolMetricTeacherList);
            Expect.Call(staffEducationOrgInformationRepository.GetAll()).Repeat.Any().Return(suppliedStaffEducationOrgInformationList);
            Expect.Call(staffInformationRepository.GetAll()).Repeat.Any().Return(suppliedStaffInformationList);
            Expect.Call(footnoteRepository.GetAll()).Repeat.Any().Return(suppliedFootnoteList);
            Expect.Call(uniqueListIdProvider.GetUniqueId(suppliedMetricVariantId)).Return(suppliedUniqueListId);
            Expect.Call(metricInstanceSetKeyResolver.GetMetricInstanceSetKey(null))
                .Constraints(
                    new ActionConstraint<SchoolMetricInstanceSetRequest>(x =>
                    {
                        Assert.That(x.SchoolId == suppliedSchoolId);
                        Assert.That(x.MetricVariantId == suppliedMetricVariantId);
                    })
                ).Return(suppliedMetricInstanceSetKey);

        }
开发者ID:sybrix,项目名称:EdFi-App,代码行数:31,代码来源:StaffMetricListServiceFixture.cs

示例4: EstablishContext

        protected override void EstablishContext()
        {
            //Prepare supplied data collections
            suppliedStudentInformationData = GetSuppliedStudentInformation();
            suppliedRootMetricNode = GetSuppliedRootNode();
            suppliedRootMetricHierarchy = GetSuppliedRootMetricHierarchy();
            suppliedRootIEnumerableOfKeyValuePair = GetSuppliedRootKeyValuePairs();

            //Set up the mocks
            studentInformationRepository = mocks.StrictMock<IRepository<StudentInformation>>();
            rootMetricNodeResolver = mocks.StrictMock<IRootMetricNodeResolver>();
            domainMetricService = mocks.StrictMock<IDomainMetricService<StudentSchoolMetricInstanceSetRequest>>();
            metricTreeToIEnumerableOfKeyValuePairProvider = mocks.StrictMock<IMetricTreeToIEnumerableOfKeyValuePairProvider>();

            //Set expectations
            Expect.Call(studentInformationRepository.GetAll()).Return(suppliedStudentInformationData);
            Expect.Call(rootMetricNodeResolver.GetRootMetricNode()).Return(suppliedRootMetricNode);

            Expect.Call(domainMetricService.Get(null))
                .Constraints(
                    new ActionConstraint<StudentSchoolMetricInstanceSetRequest>(x =>
                    {
                        Assert.That(x.SchoolId == suppliedSchoolId);
                        Assert.That(x.StudentUSI == suppliedStudentUSI);
                        Assert.That(x.MetricVariantId == suppliedRootMetricNode.MetricVariantId);
                    })
                ).Return(suppliedRootMetricHierarchy);
            Expect.Call(metricTreeToIEnumerableOfKeyValuePairProvider.FlattenMetricTree((ContainerMetric) suppliedRootMetricHierarchy.RootNode)).Return(suppliedRootIEnumerableOfKeyValuePair);
        }
开发者ID:sybrix,项目名称:EdFi-App,代码行数:29,代码来源:ExportAllMetricsServiceFixture.cs

示例5: RecoveryController

        public RecoveryController(
            IRepository<Post> postRepository,
            IRepository<Redirect> redirectRepository,
            IRepository<BlogTemplate> styleRepository,
            IRepository<User> userRepository,
            IRepository<Securable> securableRepository,
            IRepository<TemporaryUploadedBlogBackup> tempBlogBackupRepo,
            IRepository<Data.Blog> blogRepository,
            ISecurityHelper securityHelper,
            IHttpContextService httpContext)
            : base(blogRepository, httpContext, securityHelper, userRepository, securableRepository)
        {
            _postRepository = postRepository;
            _redirectRepository = redirectRepository;
            _styleRepository = styleRepository;
            _tempBlogBackupRepo = tempBlogBackupRepo;
            _userRepository = userRepository;
            _blogRepository = blogRepository;
            _securityHelper = securityHelper;

            //Naieve clean of the collection to avoid leaks in long running instances of the application
            var toDelete = _tempBlogBackupRepo.GetAll().Where(b => b.UploadTime < DateTime.Now.AddHours(-1)).ToArray();
            foreach(var toDel in toDelete)
            {
                _tempBlogBackupRepo.Delete(toDel);
            }
        }
开发者ID:rajeshpillai,项目名称:StaticVoid.Blog,代码行数:27,代码来源:RecoveryController.cs

示例6: EstablishContext

        protected override void EstablishContext()
        {
            metadataListRepository = mocks.StrictMock<IRepository<MetadataList>>();
            Expect.Call(metadataListRepository.GetAll()).Repeat.Any().Return(GetMetadataList());

            base.EstablishContext();
        }
开发者ID:sybrix,项目名称:EdFi-App,代码行数:7,代码来源:MetadataListServiceFixture.cs

示例7: EstablishContext

        protected override void EstablishContext()
        {
            //Prepare supplied data collections
            suppliedListMetadata = GetSuppliedListMetadata();
            suppliedStudentRow = GetSuppliedStudentRow();
            suppliedPriorYearStudentRow = GetSuppliedPriorYearStudentList();
            suppliedMetricVariants = GetSuppliedMetricVariants();

            //Set up the mocks
            listMetadataProvider = mocks.StrictMock<IListMetadataProvider>();
            studentListUtilitiesProvider = mocks.StrictMock<IStudentListUtilitiesProvider>();
            trendRenderingDispositionProvider = mocks.StrictMock<ITrendRenderingDispositionProvider>();
            metricStateProvider = mocks.StrictMock<IMetricStateProvider>();
            metricVariantRepository = mocks.StrictMock<IRepository<MetricVariant>>();

            windsorContainer = new WindsorContainer();
            windsorContainer.Kernel.Resolver.AddSubResolver(new ArrayResolver(windsorContainer.Kernel));
            RegisterProviders(windsorContainer);
            IoC.Initialize(windsorContainer);

            additionalPriorYearMetricProvider = IoC.Resolve<IAdditionalPriorYearMetricProvider>();

            Expect.Call(metricVariantRepository.GetAll())
                .Return(suppliedMetricVariants.AsQueryable()).Repeat.AtLeastOnce();
        }
开发者ID:sybrix,项目名称:EdFi-App,代码行数:25,代码来源:PriorYearClassroomMetricsProviderFixture.cs

示例8: EstablishContext

        protected override void EstablishContext()
        {
            staffStudentCohortRepository = mocks.StrictMock<IRepository<StaffStudentCohort>>();
            Expect.Call(staffStudentCohortRepository.GetAll()).Return(new List<StaffStudentCohort>
            {
                new StaffStudentCohort { StaffCohortId = 1, StudentUSI = 1 },
                new StaffStudentCohort { StaffCohortId = 2, StudentUSI = 2 },
                new StaffStudentCohort { StaffCohortId = 2, StudentUSI = 3 },
            }.AsQueryable()).Repeat.Any();

            staffCohortRepository = mocks.StrictMock<IRepository<StaffCohort>>();
            Expect.Call(staffCohortRepository.GetAll()).Return(new List<StaffCohort>
            {
                new StaffCohort { StaffCohortId = 1, },
                new StaffCohort { StaffCohortId = 2, },
            }.AsQueryable()).Repeat.Any();

            staffStudentAssociationRepository = mocks.StrictMock<IRepository<StaffStudentAssociation>>();
            Expect.Call(staffStudentAssociationRepository.GetAll()).Return(new List<StaffStudentAssociation>().AsQueryable()).Repeat.Any();

            query = new List<EnhancedStudentInformation>
            {
                new EnhancedStudentInformation { StudentUSI = 1, },
                new EnhancedStudentInformation { StudentUSI = 2, },
                new EnhancedStudentInformation { StudentUSI = 3, },
            }.AsQueryable();

            filter = new StaffCohortFilter(staffStudentCohortRepository);

            base.EstablishContext();
        }
开发者ID:sybrix,项目名称:EdFi-App,代码行数:31,代码来源:StaffCohortFilterFixture.cs

示例9: EstablishContext

        protected override void EstablishContext()
        {
            SetSuppliedGoal();

            localEducationAgencyMetricSchoolListRepository = mocks.StrictMock<IRepository<LocalEducationAgencyMetricInstanceSchoolList>>();
            schoolInformationRepository = mocks.StrictMock<IRepository<SchoolInformation>>();
            uniqueListIdProvider = mocks.StrictMock<IUniqueListIdProvider>();
            metricCorrelationService = mocks.StrictMock<IMetricCorrelationProvider>();
            metricInstanceSetKeyResolver = mocks.StrictMock<IMetricInstanceSetKeyResolver<LocalEducationAgencyMetricInstanceSetRequest>>();
            metricGoalProvider = mocks.StrictMock<IMetricGoalProvider>();
            metricNodeResolver = mocks.StrictMock<IMetricNodeResolver>();
            warehouseAvailabilityProvider = mocks.StrictMock<IWarehouseAvailabilityProvider>();
            maxPriorYearProvider = mocks.StrictMock<IMaxPriorYearProvider>();

            suppliedLocalEducationAgencyMetricSchoolList = GetSuppliedLocalEducationAgencyMetricSchoolList();
            suppliedSchoolInformationList = GetSuppliedSchoolInformationRepository();

            Expect.Call(warehouseAvailabilityProvider.Get()).Return(true);
            Expect.Call(maxPriorYearProvider.Get(suppliedLocalEducationAgencyId)).Return(2011);
            Expect.Call(metricNodeResolver.GetMetricNodeForLocalEducationAgencyMetricVariantId(suppliedMetricVariantId)).Return(GetSuppliedMetricMetadataNode());
            Expect.Call(localEducationAgencyMetricSchoolListRepository.GetAll()).Repeat.Any().Return(suppliedLocalEducationAgencyMetricSchoolList);
            Expect.Call(schoolInformationRepository.GetAll()).Return(suppliedSchoolInformationList);
            Expect.Call(uniqueListIdProvider.GetUniqueId(suppliedMetricVariantId)).Return(suppliedListContext);
            Expect.Call(metricInstanceSetKeyResolver.GetMetricInstanceSetKey(null)).Constraints(
                    new ActionConstraint<LocalEducationAgencyMetricInstanceSetRequest>(x =>
                    {
                        Assert.That(x.MetricVariantId == suppliedMetricVariantId);
                        Assert.That(x.LocalEducationAgencyId == suppliedLocalEducationAgencyId);
                    })).Return(suppliedMetricInstanceSetKey);
            Expect.Call(metricGoalProvider.GetMetricGoal(suppliedMetricInstanceSetKey, suppliedMetricId)).Return(suppliedGoal);

            Expect.Call(metricCorrelationService.GetRenderingParentMetricVariantIdForSchool(suppliedMetricVariantId, 1)).Constraints(
                     Rhino.Mocks.Constraints.Is.Equal(suppliedMetricVariantId), Rhino.Mocks.Constraints.Is.Anything()).Repeat.Any().Return(new MetricCorrelationProvider.MetricRenderingContext { ContextMetricVariantId = suppliedContextMetricVariantId, MetricVariantId = suppliedCorrelationMetricVariantId });
        }
开发者ID:sybrix,项目名称:EdFi-App,代码行数:34,代码来源:SchoolPriorYearMetricTableServiceFixture.cs

示例10: Add_Should_Result_In_Proper_Total_Items

        public void Add_Should_Result_In_Proper_Total_Items(IRepository<Contact, string> repository)
        {
            repository.Add(new Contact { Name = "Test User" });

            var result = repository.GetAll();
            result.Count().ShouldEqual(1);
        }
开发者ID:mgmccarthy,项目名称:SharpRepository,代码行数:7,代码来源:RepositoryAddTests.cs

示例11: MainAsync

        static async Task MainAsync(IRepository<SampleEntity> repo)
        {
            foreach (var s in await repo.GetAllAsync())
            {
                Console.WriteLine("{0} | {1}", s.ID, s.Name);
            }

            // Paged Set //
            Console.WriteLine("\nPage = 2 - Page Size = 2 :");
            var some = await repo.GetAsync(2, 2, s => s.ID);
            foreach (var s in some)
            {
                Console.WriteLine("{0} | {1}", s.ID, s.Name);
            }
                
            // Updating //
            var fox = await repo.FindAsync(e => e.Name == "Fox");
            fox.Name = "Dog";

            repo.Update(fox, fox.ID);

            // Deleting //
            Console.WriteLine("\n " + await repo.DeleteAsync(repo.Get(5)) + "\n");

            foreach (var e in repo.GetAll())
                Console.WriteLine(e.ID + " | " + e.Name);
        }
开发者ID:ioab,项目名称:.NET-EF6-GenericRepository,代码行数:27,代码来源:Program.cs

示例12: EstablishContext

        protected override void EstablishContext()
        {
            repository = mocks.StrictMock<IRepository<EdFi.Dashboards.Application.Data.Entities.LocalEducationAgency>>();
            Expect.Call(repository.GetAll()).Return(GetLocalEducationAgency());

            resolutionService = new RouteValueResolutionService(repository);
        }
开发者ID:sybrix,项目名称:EdFi-App,代码行数:7,代码来源:RouteValueResolutionServiceFixtures.cs

示例13: EstablishContext

        protected override void EstablishContext()
        {
            SetSuppliedGoal();

            base.EstablishContext();

            suppliedData = GetData();

            repository = mocks.StrictMock<IRepository<SchoolMetricGradeDistribution>>();
            metricInstanceSetKeyResolver = mocks.StrictMock<IMetricInstanceSetKeyResolver<SchoolMetricInstanceSetRequest>>();
            metricGoalProvider = mocks.StrictMock<IMetricGoalProvider>();
            metricNodeResolver = mocks.StrictMock<IMetricNodeResolver>();

            Expect.Call(metricNodeResolver.GetMetricNodeForSchoolFromMetricVariantId(suppliedSchoolId, suppliedMetricVariantId)).Return(GetSuppliedMetricMetadataNode());
            Expect.Call(repository.GetAll()).Return(suppliedData);
            Expect.Call(metricInstanceSetKeyResolver.GetMetricInstanceSetKey(null))
                .Constraints(
                    new ActionConstraint<SchoolMetricInstanceSetRequest>(x =>
                    {
                        Assert.That(x.SchoolId == suppliedSchoolId);
                        Assert.That(x.MetricVariantId == suppliedMetricVariantId);
                    })
                ).Return(suppliedMetricInstanceSetKey);
            Expect.Call(metricGoalProvider.GetMetricGoal(suppliedMetricInstanceSetKey, suppliedMetricId)).Return(suppliedGoal);
        }
开发者ID:sybrix,项目名称:EdFi-App,代码行数:25,代码来源:GradeLevelChartServiceFixture.cs

示例14: EstablishContext

        protected override void EstablishContext()
        {
            //Prepare supplied data collections
            suppliedStudentMetricBenchmarkAssessmentData = GetSuppliedStudentMetricBenchmarkAssessment();
            suppliedSchoolGoal = GetSuppliedMetricGoal();
            suppliedMetricState = GetSuppliedMetricState();

            //Set up the mocks
            metricNodeResolver = mocks.StrictMock<IMetricNodeResolver>();
            studentMetricBenchmarkAssessmentRepository = mocks.StrictMock<IRepository<StudentMetricBenchmarkAssessment>>();
            metricGoalProvider = mocks.StrictMock<IMetricGoalProvider>();
            metricStateProvider = mocks.StrictMock<IMetricStateProvider>();
            metricInstanceSetKeyResolver = mocks.StrictMock<IMetricInstanceSetKeyResolver<StudentSchoolMetricInstanceSetRequest>>();

            //Set expectations
            Expect.Call(metricNodeResolver.GetMetricNodeForStudentFromMetricVariantId(suppliedSchoolId, suppliedMetricVariantId)).Return(GetMetricMetadataNode());
            Expect.Call(studentMetricBenchmarkAssessmentRepository.GetAll()).Return(suppliedStudentMetricBenchmarkAssessmentData);
            Expect.Call(
                metricInstanceSetKeyResolver.GetMetricInstanceSetKey(null))
                .Constraints(
                    new ActionConstraint<StudentSchoolMetricInstanceSetRequest>(x =>
                    {
                        Assert.That(x.SchoolId == suppliedSchoolId);
                        Assert.That(x.MetricVariantId == suppliedMetricVariantId);
                        Assert.That(x.StudentUSI == suppliedStudentUSI);
                    })
                ).Return(suppliedMetricInstanceSetKey);
            Expect.Call(metricGoalProvider.GetMetricGoal(suppliedMetricInstanceSetKey, suppliedMetricId)).Return(suppliedSchoolGoal);
            Expect.Call(metricStateProvider.GetState(suppliedMetricId, suppliedMetricValueStr, "System.Double")).Repeat.Any().Return(suppliedMetricState);
            Expect.Call(metricStateProvider.GetState(suppliedMetricId, "", "System.Double")).Return(suppliedMetricState);
        }
开发者ID:sybrix,项目名称:EdFi-App,代码行数:31,代码来源:BenchmarkHistoricalChartServiceFixture.cs

示例15: DashboardViewModel

 public DashboardViewModel(
     IRepository<ClassModel> repository)
 {
     _repository = repository;
     Title = "My window";
     Classes = new ObservableCollection<ClassModel>(_repository.GetAll().Result);
 }
开发者ID:ArturR89,项目名称:WPFApplication,代码行数:7,代码来源:DashboardViewModel.cs


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