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


C# IWindsorContainer.AddComponentLifeStyle方法代码示例

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


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

示例1: Register

 public void Register(IWindsorContainer container)
 {
     Assembly.GetAssembly(typeof(ControllersRegistrarMarker)).GetExportedTypes()
             .Where(IsController)
             .Each(type => container.AddComponentLifeStyle(
                                   type.Name.ToLower(),
                                   type,
                                   LifestyleType.Transient));
 }
开发者ID:riccardod,项目名称:Who-Can-Help-Me,代码行数:9,代码来源:ControllerRegistrar.cs

示例2: RegisterControllersInContainer

 // Dies nur als Beispiel, besser direkt die Implementierung von http://mvccontrib.org verwenden
 private static void RegisterControllersInContainer(IWindsorContainer container)
 {
     var controllerType = from t in typeof(HomeController).Assembly.GetTypes()
                       where typeof (IController).IsAssignableFrom(t)
                       select t;
     foreach (var type in controllerType)
     {
         container.AddComponentLifeStyle(type.FullName, type, LifestyleType.Transient);
     }
 }
开发者ID:DerAlbertCom,项目名称:Samples,代码行数:11,代码来源:Global.asax.cs

示例3: RegisterTypesInContainer

 private static void RegisterTypesInContainer(IWindsorContainer container)
 {
     RegisterControllersInContainer(container);
     container.AddComponentLifeStyle<ICustomerRepository, CustomerRepository>(LifestyleType.Transient);
     container.AddComponentLifeStyle<IOrderRepository, OrderRepository>(LifestyleType.Transient);
     container.AddComponentLifeStyle<ICustomerService, CustomerService>(LifestyleType.Transient);
     container.AddComponentLifeStyle<IOrderService, OrderService>(LifestyleType.Transient);
     container.AddComponentLifeStyle<ICustomerMapper, CustomerMapper>(LifestyleType.Singleton);
     container.AddComponentLifeStyle<IOrderMapper, OrderMapper>(LifestyleType.Singleton);
 }
开发者ID:DerAlbertCom,项目名称:Samples,代码行数:10,代码来源:Global.asax.cs

示例4: WindsorControllerFactory

        // The constructor:
        // 1. Sets up a new IoC container
        // 2. Registers all components specified in web.config
        // 3. Registers all controller types as components
        public WindsorControllerFactory()
        {
            // Instantiate a container, taking configuration from web.config
            container = WindsorContainerProvider.Instance();

            // Also register all the controller types as transient
            var controllerTypes =
                from t in Assembly.GetExecutingAssembly().GetTypes()
                where typeof(IController).IsAssignableFrom(t)
                select t;

            foreach (Type t in controllerTypes)
            {
                container.AddComponentLifeStyle(t.FullName, t, LifestyleType.Transient);
            }
        }
开发者ID:justin-arvay,项目名称:Trakker,代码行数:20,代码来源:WindsorControllerFactory.cs

示例5: Configure

        public static void Configure(IWindsorContainer container)
        {
            //allows us to take a dependency on arrays
            container.Kernel.Resolver.AddSubResolver(new ArrayResolver(container.Kernel));

            //
            container.AddComponent<Dispatcher>("dispatcher");

            //argument parsing

            container.AddComponentLifeStyle<IArgumentParser, ArgumentParser>("argumentParser", LifestyleType.Transient);
            container.AddComponentLifeStyle<IArgumentMapFactory, ArgumentMapFactory>("argumentMapFactory", LifestyleType.Transient);

            //helper shims
            container.AddComponentLifeStyle<IConsole, ConsoleHelper>("consoleHelper", LifestyleType.Transient);
            container.AddComponentLifeStyle<IPath, PathAdapter>("pathAdapter", LifestyleType.Transient);
            container.AddComponentLifeStyle<IFileSystem, FileSystem>("fileSystem", LifestyleType.Transient);

            //templating
            container.AddComponentLifeStyle<ITemplateProcessor, NVelocityTemplateProcessor>("templateProcessor",
                                                                                                LifestyleType.Transient);

            //package repository
            container.AddComponent<IPackageRepository, LocalPackageRepository>("package.repository");

            //project stuff
            container.AddComponentLifeStyle<IProjectManifestStore, XmlProjectManifestStore>("xmlProjectStore", LifestyleType.Transient);
            container.AddComponentLifeStyle<IProjectManifestRepository, ProjectManifestRepository>("projectManifestRepository", LifestyleType.Transient);

            //default package commands
            container.AddComponent<ICommand, HelpCommand>("help");
            container.Register(
                Component.For<ICommand>().ImplementedBy<NewProjectCommand>()
                .Named("project")
                .Parameters(
                    Parameter.ForKey("rootTemplateDirectory").Eq("a"), //TODO: correct this
                    Parameter.ForKey("defaultTemplate").Eq("b"))); //TODO: Correct this

            SetupNewProject(container);
            container.AddComponent<ICommand, ListCommand>("list");
            container.AddComponent<ICommand, InstallCommand>("install");
        }
开发者ID:developernotes,项目名称:nu,代码行数:42,代码来源:NuConfiguration.cs

示例6: Application_Start

        protected void Application_Start(object sender, EventArgs e)
        {
            XmlConfigurator.ConfigureAndWatch(new FileInfo(Server.MapPath("/log4net.config")));
            GlobalLog = LogManager.GetLogger(typeof (Global));
            GlobalLog.Debug("Application_Start");
            container = new WindsorContainer();
            container.AddComponentLifeStyle<Service>(LifestyleType.Transient);
            container.AddFacility<FactorySupportFacility>();
            container.Register(Component.For<IHttpModule>()
                                   .ImplementedBy<UserHttpModule>()
                                   .LifeStyle.Custom<PerHttpApplicationLifestyleManager>());
            container.Register(Component.For<IHttpModule>()
                                   .ImplementedBy<UserHttpModule2>()
                                   .LifeStyle.Custom<PerHttpApplicationLifestyleManager>());

            container.Register(Component.For<HttpRequestBase>()
                .LifeStyle.PerWebRequest
                .UsingFactoryMethod(() => new HttpRequestWrapper(HttpContext.Current.Request)));

            container.Register(Component.For<HttpContextBase>()
                .LifeStyle.PerWebRequest
                .UsingFactoryMethod(() => new HttpContextWrapper(HttpContext.Current)));
        }
开发者ID:ruanzx,项目名称:mausch,代码行数:23,代码来源:Global.asax.cs

示例7: SetupNewProject

        private static void SetupNewProject(IWindsorContainer container)
        {
            container.AddComponentLifeStyle<ITransformationElement,FolderTransformationElement>("folderTransformation",
                                            LifestyleType.Transient);

            container.AddComponentLifeStyle<ITransformationElement,FileTransformationElement>("fileTransformation", LifestyleType.Transient);

            container.AddComponentLifeStyle<IProjectTransformationPipeline,ProjectTransformationPipeline>("transformationPipeline", LifestyleType.Transient);
        }
开发者ID:developernotes,项目名称:nu,代码行数:9,代码来源:NuConfiguration.cs

示例8: Install

 public void Install(IWindsorContainer container, IConfigurationStore store)
 {
     container.AddComponentLifeStyle<TwitterContext>(LifestyleType.Singleton);
 }
开发者ID:brsmith,项目名称:BibleOnTwitter,代码行数:4,代码来源:LinqToTwitterInstaller.cs

示例9: RegisterComponents

        public void RegisterComponents(IWindsorContainer container)
        {
            container.AddComponentLifeStyle("newscontroller", typeof(NewsController), LifestyleType.Transient);

            container.AddComponent("News", typeof(Tags.News));
        }
开发者ID:pollingj,项目名称:Membrane-CMS,代码行数:6,代码来源:Plugin.cs

示例10: RegisterRepositories

        private static void RegisterRepositories(IWindsorContainer container)
        {
            IEnumerable<Type> repositories = Assembly.GetExecutingAssembly().
                GetTypes().Where(IsRepository);

            foreach (Type repository in repositories)
            {
                container.AddComponentLifeStyle(repository.Name, repository,
                  LifestyleType.Transient);
            }
        }
开发者ID:gkeary,项目名称:myGetOrg,代码行数:11,代码来源:Global.asax.cs

示例11: RegisterGateways

 private static void RegisterGateways(IWindsorContainer container)
 {
     container.AddComponentLifeStyle("bloggerGateway",
     typeof(BloggerGateway), LifestyleType.Transient);
 }
开发者ID:gkeary,项目名称:myGetOrg,代码行数:5,代码来源:Global.asax.cs


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