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


C# RepositoryFactory.GetRepository方法代码示例

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


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

示例1: Factory_Should_Return_Cached_Repository

        public void Factory_Should_Return_Cached_Repository()
        {
            var factory = new RepositoryFactory(TestEnvironment.GetSqlServerDataProvider());

            var repository = factory.GetRepository<Product>();
            var cachedRepository = factory.GetRepository<Product>();

            Assert.AreEqual(repository, cachedRepository);
        }
开发者ID:jdaigle,项目名称:Centro,代码行数:9,代码来源:FactoryTests.cs

示例2: Test_GetDao_AllreadyUsed_SameFactoryIsReturned

        public void Test_GetDao_AllreadyUsed_SameFactoryIsReturned()
        {
            var factoryMock = new Mock<IRepositoryFactory>();
            var factory = factoryMock.Object;

            var sut = new RepositoryFactory(factory, null, NHibernateHelper);

            var firstTime = sut.GetRepository<IIdentifiable>();

            Assert.That(sut.GetRepository<IIdentifiable>(), Is.SameAs(firstTime));
        }
开发者ID:mmsommer,项目名称:Ogd.Virarium,代码行数:11,代码来源:RepositoryFactoryTest.cs

示例3: GrassrootsMembershipService

        public GrassrootsMembershipService()
        {
            var userProfileRepositoryFactory = new RepositoryFactory<IUserProfileRepository>();
            userProfileRepository = userProfileRepositoryFactory.GetRepository();

            var userRepositoryFactory = new RepositoryFactory<IUserRepository>();
            userRepository = userRepositoryFactory.GetRepository();
        }
开发者ID:marchon,项目名称:Grassroots,代码行数:8,代码来源:GrassrootsMembershipService.cs

示例4: Factory_Should_Return_Repository

        public void Factory_Should_Return_Repository()
        {
            var factory = new RepositoryFactory(TestEnvironment.GetSqlServerDataProvider());

            var repository = factory.GetRepository<Product>();

            Assert.IsNotNull(repository);
        }
开发者ID:jdaigle,项目名称:Centro,代码行数:8,代码来源:FactoryTests.cs

示例5: GrassrootsRoleService

        public GrassrootsRoleService()
        {
            var userProfileRepositoryFactory = new RepositoryFactory<IUserProfileRepository>();
            userProfileRepository = userProfileRepositoryFactory.GetRepository();

            var userRepositoryFactory = new RepositoryFactory<IUserRepository>();
            userRepository = userRepositoryFactory.GetRepository();

            var roleRepositoryFactory = new RepositoryFactory<IRoleRepository>();
            roleRepository = roleRepositoryFactory.GetRepository();
        }
开发者ID:JordanRift,项目名称:Grassroots,代码行数:11,代码来源:GrassrootsRoleService.cs

示例6: Test_GetDao_FactorySupplied_VerifySuppliedFactoryCreateIsCalled

        public void Test_GetDao_FactorySupplied_VerifySuppliedFactoryCreateIsCalled()
        {
            var factoryMock = new Mock<IRepositoryFactory>();
            var factory = factoryMock.Object;

            var sut = new RepositoryFactory(factory, null, NHibernateHelper);

            sut.GetRepository<IIdentifiable>();

            factoryMock.Verify(x => x.GetRepository<IIdentifiable>());
        }
开发者ID:mmsommer,项目名称:Ogd.Virarium,代码行数:11,代码来源:RepositoryFactoryTest.cs

示例7: Must_Return_NULL_For_Invalid_Entity_If_It_Is_Not_In_Context

 public void Must_Return_NULL_For_Invalid_Entity_If_It_Is_Not_In_Context()
 {
     //
     // Arrange
     //
     var mockContext = new Mock<EFDbContext>();
     var repositoryFacotory = new RepositoryFactory(mockContext.Object);
     //
     // Act
     //
     var result = repositoryFacotory.GetRepository<IModel>();
     //
     // Assert
     //
     Assert.IsNotNull(result);
 }
开发者ID:Cheranga,项目名称:DAL,代码行数:16,代码来源:RepositoryFactoryTest.cs

示例8: Must_Return_Repository_For_Valid_Entity_Regardless_It_Was_Registered

        public void Must_Return_Repository_For_Valid_Entity_Regardless_It_Was_Registered()
        {
            //
            // Arrange
            //
            var mockDbSet = new Mock<DbSet<IModel>>();
            var mockContext = new Mock<EFDbContext>();
            mockContext.Setup(x => x.Set<IModel>()).Returns(mockDbSet.Object);

            var repositoryFacotory = new RepositoryFactory(mockContext.Object);
            //
            // Act
            //
            var result = repositoryFacotory.GetRepository<IModel>();
            //
            // Assert
            //
            Assert.IsNotNull(result);
        }
开发者ID:Cheranga,项目名称:DAL,代码行数:19,代码来源:RepositoryFactoryTest.cs

示例9: GetRoleSelectList

        public static SelectList GetRoleSelectList(int? id)
        {
            RoleDictionary = new Dictionary<string, string>();
            var repositoryFactory = new RepositoryFactory<IOrganizationRepository>();
            var repository = repositoryFactory.GetRepository();
            var organization = repository.GetDefaultOrganization(readOnly: true);

            foreach (var role in organization.Roles)
            {
                RoleDictionary.Add(new KeyValuePair<string, string>(role.RoleID.ToString(CultureInfo.InvariantCulture), role.Name));
            }
            return new SelectList(RoleDictionary, "Key", "Value", id);
        }
开发者ID:JordanRift,项目名称:Grassroots,代码行数:13,代码来源:UIHelpers.cs

示例10: Must_Return_Repository_When_Registered

        public void Must_Return_Repository_When_Registered()
        {
            //
            // Arrange
            //
            var mockContext = new Mock<EFDbContext>();
            var mockRepository = new Mock<IRepository<IModel>>();

            var repositoryFactory = new RepositoryFactory(mockContext.Object);
            repositoryFactory.SetCustomRepo(mockRepository.Object);

            //
            // Act
            //
            var result = repositoryFactory.GetRepository<IModel>();
            //
            // Assert
            //
            Assert.IsNotNull(result);
        }
开发者ID:Cheranga,项目名称:DAL,代码行数:20,代码来源:RepositoryFactoryTest.cs

示例11: UserProfileService

 public UserProfileService()
 {
     var repositoryFactory = new RepositoryFactory<IUserProfileRepository>();
     userProfileRepository = repositoryFactory.GetRepository();
 }
开发者ID:marchon,项目名称:Grassroots,代码行数:5,代码来源:UserProfileService.cs

示例12: CampaignService

 public CampaignService()
 {
     var repositoryFactory = new RepositoryFactory<ICampaignRepository>();
     campaignRepository = repositoryFactory.GetRepository();;
 }
开发者ID:JordanRift,项目名称:Grassroots,代码行数:5,代码来源:CampaignService.cs


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