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


C# IWindsorContainer类代码示例

本文整理汇总了C#中IWindsorContainer的典型用法代码示例。如果您正苦于以下问题:C# IWindsorContainer类的具体用法?C# IWindsorContainer怎么用?C# IWindsorContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Install

        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container.Register(Classes.FromThisAssembly()
                                .BasedOn<IController>()
                                .LifestyleTransient());

            container.Register(Component
                                .For<IControllerFactory>()
                                .UsingFactoryMethod(_ => new WindsorControllerFactory(container))
                                .LifeStyle.Singleton);

            container.Register(Component.For<IRdfTranslator>()
                                .UsingFactoryMethod(_ => new RdfTranslator(container.Resolve<IMongoDataContextProvider>()))
                                .LifeStyle.PerWebRequest);

            container.Register(Component.For<IMongoDataContextProvider>()
                                .UsingFactoryMethod(_ => new MongoDataContextProvider())
                                .LifeStyle.PerWebRequest);

            //container.Register(Component.For<IFormsAuthenticationService>()
            //                    .UsingFactoryMethod(_ => new FormsAuthenticationService())
            //                    .LifeStyle.PerWebRequest);

            //container.Register(Component.For<IMembershipService>()
            //                    .UsingFactoryMethod(_ => new AccountMembershipService())
            //                    .LifeStyle.PerWebRequest);
        }
开发者ID:bogdanbl,项目名称:OntoWebStore,代码行数:27,代码来源:ControllersInstaller.cs

示例2: AddComponentsTo

        public static void AddComponentsTo(IWindsorContainer container)
        {
            AddGenericRepositoriesTo(container);

            container.Register(Component.For<IValidator>().ImplementedBy<Validator>().Named("validator"));
            container.Register(Component.For<IDbContext>().ImplementedBy<DbContext>().Named("dbContext"));
        }
开发者ID:ucdavis,项目名称:BenefitsAllocationUpload,代码行数:7,代码来源:ComponentRegistrar.cs

示例3: AddApplicationServicesTo

 private static void AddApplicationServicesTo(IWindsorContainer container)
 {
     container.Register(
         AllTypes.Pick()
         .FromAssemblyNamed("Anuncios.ApplicationServices")
         .WithService.FirstInterface());
 }
开发者ID:gastonadrian,项目名称:Anuncios,代码行数:7,代码来源:ComponentRegistrar.cs

示例4: Install

 public void Install(IWindsorContainer container)
 {
     container.Register(
         Component.For<IAuthenticationUserViewUserService>().ImplementedBy<AuthenticationUserViewUserService>().LifeStyle.PerThread,
         Component.For<IAuthenticationUserViewRoleService>().ImplementedBy<AuthenticationUserViewRoleService>().LifeStyle.PerThread
     );
 }
开发者ID:modulexcite,项目名称:framework-1,代码行数:7,代码来源:BusWindsorInstaller.cs

示例5: RemoveDigestAuthorisationContributor

        /// <summary>
        /// http://trac.caffeine-it.com/openrasta/ticket/118#comment:1
        /// See OpenRasta.DigestAuthorizerContributor.WriteCredentialRequest
        /// TODO: Need to implement 
        /// </summary>
        public static void RemoveDigestAuthorisationContributor(IWindsorContainer container)
        {
            var contributors = container.Kernel.GetHandlers(typeof(IPipelineContributor));
            var digestContributor = contributors.SingleOrDefault(i => i.ComponentModel.Implementation == typeof(DigestAuthorizerContributor));

            container.Kernel.RemoveComponent(digestContributor.ComponentModel.Name);
        }
开发者ID:gregsochanik,项目名称:OAuthInOpenRasta,代码行数:12,代码来源:ConfigurationSource.cs

示例6: Install

 public void Install(IWindsorContainer container, IConfigurationStore store)
 {
     container.Register(
         AllTypes.FromAssemblyNamed("SharpArchTemplate.Web.Mvc")
             .InNamespace("SharpArchTemplate.Web.Mvc.Controllers.Queries", true)
             .WithService.DefaultInterfaces());
 }
开发者ID:seif,项目名称:Sharp-Architecture-Template-RavenDB,代码行数:7,代码来源:QueryInstaller.cs

示例7: Install

 public void Install(IWindsorContainer container)
 {
     container.Register(
         Component.For<ILoginUserService>().ImplementedBy<LoginUserService>().LifeStyle.PerWebRequest,
         Component.For<ILoginRoleService>().ImplementedBy<LoginRoleService>().LifeStyle.PerWebRequest
     );
 }
开发者ID:modulexcite,项目名称:framework-1,代码行数:7,代码来源:WebWindsorInstaller.cs

示例8: Install

 public void Install(IWindsorContainer container, IConfigurationStore store)
 {
     container.Register(
         Component.For<IConfigureWiringForTests, IResetTestDatabases>()
             .Instance(new DocumentDbTestConfigurer(container))
         );
 }
开发者ID:RichieYang,项目名称:Composable.Monolithic,代码行数:7,代码来源:InMemoryAccountManagementQuerymodelsSessionInstaller.cs

示例9: Install

 public void Install(IWindsorContainer container, IConfigurationStore store)
 {
     container.Register(
         Classes.FromThisAssembly().BasedOn<IInitialiser>().WithService.FromInterface(),
         Component.For<IList<IInitialiser>>().UsingFactoryMethod<List<IInitialiser>>(
             c => new List<IInitialiser>(c.ResolveAll<IInitialiser>())));
 }
开发者ID:AdamCollings,项目名称:dbqf,代码行数:7,代码来源:InitialiserInstaller.cs

示例10: Configure

        public static void Configure(IWindsorContainer container)
        {
            Mapper.Initialize(x => x.ConstructServicesUsing(type => ResolveType(container, type)));

            Mapper.CreateMap<User, UserListItemViewModel>();

            Mapper.CreateMap<Task, TaskListItemViewModel>();
            Mapper.CreateMap<Task, TaskInputViewModel>()
                .ForMember(m => m.AvaiableProjects, opt => opt.ResolveUsing<AvaiableProductsResolver>().FromMember(x => x.Owner.Id));

            Mapper.CreateMap<TaskInputViewModel, Task>()
                .ForMember(m => m.Owner, o => o.ResolveUsing<LoadingEntityResolver<User>>().FromMember(x => x.OwnerId))
                .ForMember(m => m.Project, o => o.ResolveUsing<LoadingEntityResolver<Project>>().FromMember(x => x.ProjectId));

            Mapper.CreateMap<Project, ProjectListItemViewModel>();
            Mapper.CreateMap<Project, ProjectViewModel>();
            Mapper.CreateMap<Project, ProjectInputViewModel>()
                .ForMember(m => m.SelectedOwnerId, o => o.MapFrom(x => x.Owner.Id))
                .ForMember(m => m.SelectedParticipants, o => o.MapFrom(x => x.Participants.Select(p => p.Id)))
                .ForMember(m => m.AvaiableOwners, opt => opt.ResolveUsing<AvaiableProductOwnersResolver>())
                .ForMember(m => m.AvaiableParticipants, opt => opt.ResolveUsing<AvaiableProductOwnersResolver>());

            Mapper.CreateMap<ProjectInputViewModel, Project>()
                .ForMember(m => m.Owner, o => o.ResolveUsing<LoadingEntityResolver<User>>().FromMember(x => x.SelectedOwnerId))
                .ForMember(dst => dst.Participants, opt => opt.ResolveUsing<LoadingCollectionEntityResolver<User>>().FromMember(x => x.SelectedParticipants))
                .ForMember(dst => dst.Tasks, opt => opt.Ignore());
        }
开发者ID:adalbertus,项目名称:BaseMVC,代码行数:27,代码来源:AutoMapper.cs

示例11: Install

 public void Install(IWindsorContainer container, IConfigurationStore store)
 {
     container.Register(
        Component.For(typeof (ICustomWindowManager), typeof (IWindowManager)).ImplementedBy<CustomWindowManager>().LifeStyle.Is(LifestyleType.Singleton),
        Component.For<IEventAggregator>().ImplementedBy<EventAggregator>().LifeStyle.Is(LifestyleType.Singleton)
        );
 }
开发者ID:nakioman,项目名称:furryrun-editor,代码行数:7,代码来源:CaliburnInstaller.cs

示例12: ConfigMetadata

        private static void ConfigMetadata(IModelRegistrar reg, IWindsorContainer container)
        {
            reg.ModelNamespacePattern("Centros.Model.{0}, Centros.Model");
            reg.RegisterPatterApplier(new IdPatternApplier { IdPropertyName = "Id" });
            reg.RegisterPatterApplier(new ReferencePatternApplier { ExcludeReferenceTypes = new[] { typeof(Horario) } });
            reg.DomainAccessorAccessor(modelType =>
                                       	{
                                       		var providerType = typeof (IDomainAccessor<>).MakeGenericType(modelType);
                                       		return (IDomainAccessor<object>) container.Resolve(providerType);
                                       	}).
                DomainMutatorAccessor(modelType =>
                                      	{
                                      		var providerType = typeof (IDomainMutator<>).MakeGenericType(modelType);
                                      		return (IDomainMutator<object>) container.Resolve(providerType);
                                      	});

            reg.ForType<Centro>();
            reg.ForType<Educador>();
            reg.ForType<Horario>();
            reg.ForType<Institucion>(md => md.Description("Institución"));
            reg.ForType<Jurisdiccion>(md => md.Description("Jurisdicción"));
            reg.ForType<Organizacion>(md => md.Description("Organización"));
            reg.ForType<Participacion>();
            reg.ForType<Participante>();
            reg.ForType<Registro>();
            reg.ForType<Taller>();
        }
开发者ID:carlospeix,项目名称:ConfUi,代码行数:27,代码来源:MetadataBuilderConfig.cs

示例13: AddGenericRepositoriesTo

        private static void AddGenericRepositoriesTo(IWindsorContainer container)
        {
            container.Register(
                    Component
                        .For(typeof(IEntityDuplicateChecker))
                        .ImplementedBy(typeof(EntityDuplicateChecker))
                        .Named("entityDuplicateChecker"));

            container.Register(
                    Component
                        .For(typeof(IRepository<>))
                        .ImplementedBy(typeof(Repository<>))
                        .Named("repositoryType"));

            container.Register(
                    Component
                        .For(typeof(INHibernateRepository<>))
                        .ImplementedBy(typeof(NHibernateRepository<>))
                        .Named("nhibernateRepositoryType"));

            container.Register(
                    Component
                        .For(typeof(IRepositoryWithTypedId<,>))
                        .ImplementedBy(typeof(RepositoryWithTypedId<,>))
                        .Named("repositoryWithTypedId"));

            container.Register(
                    Component
                        .For(typeof(INHibernateRepositoryWithTypedId<,>))
                        .ImplementedBy(typeof(NHibernateRepositoryWithTypedId<,>))
                        .Named("nhibernateRepositoryWithTypedId"));
        }
开发者ID:khoudeshell,项目名称:Triple-Crown-Royal,代码行数:32,代码来源:ComponentRegistrar.cs

示例14: Install

        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container.Register(Component
                .For<IDatabaseContext>()
                .ImplementedBy<DatabaseContext>()
                .DependsOn(Dependency.OnValue("nameOrConnectionString", "DefaultConnection"))
                .LifeStyle.Transient
                );

            container.Register(Component
                .For<IUserStore>()
                .ImplementedBy<UserStore>()
                .LifeStyle.Transient);

            container.Register(Component
                .For<IPostStore>()
                .ImplementedBy<PostStore>()
                .LifeStyle.Transient
                );

            container.Register(Component
                .For<IUnitOfWork>()
                .ImplementedBy<UnitOfWork>()
                .LifeStyle.Transient
                );
        }
开发者ID:AnnaKerina,项目名称:TrainingProject,代码行数:26,代码来源:PersistenceInstaller.cs

示例15: Install

 public void Install(IWindsorContainer container)
 {
     container.Register(
         AllTypes.FromThisAssembly().BasedOn<IEmailTemplateManagementDatabaseFactory>().Configure(
             component =>
             {
                 component.Named(component.Implementation.Name);
                 component.LifeStyle.Is(LifestyleType.Thread);
             }).WithService.Base(),
         AllTypes.FromThisAssembly().BasedOn<IEmailTemplateManagementUnitOfWork>().Configure(
             component =>
             {
                 component.Named(component.Implementation.Name);
                 component.LifeStyle.Is(LifestyleType.Thread);
             }).WithService.Base(),
         AllTypes.FromThisAssembly().BasedOn<IEmailTemplateManagementTemplateRepository>().Configure(
             component =>
             {
                 component.Named(component.Implementation.Name);
                 component.LifeStyle.Is(LifestyleType.Thread);
             }).WithService.Base(),
         AllTypes.FromThisAssembly().BasedOn<IProvideEmailTemplateManagementSessionFactoryInitialisation>().Configure(
             component =>
             {
                 component.Named(component.Implementation.Name);
                 component.LifeStyle.Is(LifestyleType.Thread);
             }).WithService.Base()
     );
 }
开发者ID:modulexcite,项目名称:framework-1,代码行数:29,代码来源:BusWindsorInstaller.cs


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