• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IWindsorContainer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Install

 public void Install(IWindsorContainer container, IConfigurationStore store)
 {
     container.Register(Component.For<IMainWindow, IInvokable>().ImplementedBy<MainWindow>().LifeStyle.Singleton);
     container.Register(Component.For<ISystemNotification>().ImplementedBy<SystemNotification>().LifeStyle.Singleton);
     container.Register(Component.For<IGameDetailView>().ImplementedBy<GameDetailControl>().LifeStyle.Transient);
     container.Register (Component.For<IActiveSessionView> ().ImplementedBy<ActiveSessionControl> ().LifeStyle.Transient);
 }
开发者ID:kevinbrill,项目名称:tempusgameit-client,代码行数:7,代码来源:ViewInstaller.cs


示例17: Install

        /// <summary>
        /// Performs the installation in the <see cref="T:Castle.Windsor.IWindsorContainer" />.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="store">The configuration store.</param>
        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container.AddFacility<LoggingFacility>(f => f.UseLog4Net());
            container.Register(
                Component.For<IRepository>()
                    .ImplementedBy<GenericRepository>()
                    .DependsOn(
                        Dependency.OnValue("connectionString", ConfigurationManager.ConnectionStrings["MongoDB"].ConnectionString),
                        Dependency.OnAppSettingsValue("databaseName", "DbName")),

                Component.For<IFoodProcessor>()
                    .ImplementedBy<FoodProcessor>(),

                Component.For<IBoardProcessor>()
                    .ImplementedBy<BoardProcessor>()
                    .DynamicParameters((DynamicParametersDelegate)GetBoardTemplates),

                Component.For<BoardTemplate>()
                    .ImplementedBy<DailyMenuBoardTemplate>()
                    .Named("DailyMenuBoardTemplate"),

                Component.For<BoardTemplate>()
                    .ImplementedBy<SalatsBoardTemplate>()
                    .Named("SalatsBoardTemplate"));
        }
开发者ID:RadoBuransky,项目名称:CanteenBoard,代码行数:30,代码来源:CommonInstaller.cs


示例18: CreateTestData

        static void CreateTestData(IWindsorContainer container)
        {
            //Test data generation
            var stg = container.Resolve<IGuestBookDataProvider>();

            Task.WaitAll(new Task[]
            {
                stg.AddUser("user1", "Aleksey Fedorov"),
                stg.AddUser("user2", "Pavel Potapov"),
                stg.AddMessage("user2", "Test msg 1"),
                stg.AddMessage("user2", "Test msg 2"),
                stg.AddMessage("user2", "Test msg 3"),
                stg.AddMessage("user1", "Test msg 11"),
                stg.AddMessage("user1", "Test msg 21"),

                stg.AddMessage("user3", "Test msg 31"),

                stg.AddUser("user4", "Ivan Petrov")
            });

            var users = stg.GetUsers(1, 5).Result;
            foreach (var u in users.Items)
                _logger.Info($"{u.UserLogin} - {u.DisplayName}");

            var messages = stg.GetUserMessages("user2", 1, 5).Result;
            foreach (var m in messages.Items)
                _logger.Info($"{m.Text} - {m.Created}");
        }
开发者ID:alexf2,项目名称:ReactiveWebServerProto,代码行数:28,代码来源:Program.cs


示例19: AddResolversAndFacilities

 private static void AddResolversAndFacilities(IWindsorContainer container)
 {
     container.Kernel.Resolver.AddSubResolver(new CachingSessionResolver());
     container.Kernel.Resolver.AddSubResolver(new ArrayResolver(container.Kernel));
     container.AddFacility<TypedFactoryFacility>();
     container.AddFacility<StartableFacility>();
 }
开发者ID:jladuval,项目名称:MyPlace,代码行数:7,代码来源:ContainerInit.cs


示例20: AddCustomRepositoriesTo

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IWmiInstance类代码示例发布时间:2022-05-24
下一篇:
C# IWindowsFormsEditorService类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap