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


C# IWindsorContainer.ResolveAll方法代码示例

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


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

示例1: Main

        static void Main(string[] args)
        {
            container = BotRunnerBootstrapper.Init();

            var fineBot = new Bot();
            var fineBotResponders = container.ResolveAll<IFineBotResponder>();
            foreach (IFineBotResponder responder in fineBotResponders)
            {
                fineBot.Responders.Add(responder);
            }

            fineBot.RespondsTo("hi").IfBotIsMentioned().With("Stop resisting citizen!");
            fineBot.CreateResponder(x => !x.BotHasResponded, rc => "My responses are limited, you must ask the right question...");

            var task = fineBot.Connect(ConfigurationManager.AppSettings["BotKey"]);
            Console.WriteLine(string.Format("{0}: Bot is runnning, type 'die' to make it die", DateTime.Now));

            var secondCousinBot = new Bot();
            var secondCousinResponders = container.ResolveAll<ISecondCousinResponder>();
            foreach (ISecondCousinResponder responder in secondCousinResponders)
            {
                secondCousinBot.Responders.Add(responder);
            }
            var seconderTask = secondCousinBot.Connect(ConfigurationManager.AppSettings["SeconderBotKey"]);
            Console.WriteLine(string.Format("{0}: Finebot's second cousin is also also running. Some say he can't die.", DateTime.Now));

            while(Console.ReadLine() != "die")
            {

            }

            container.Dispose();
        }
开发者ID:prinzo,项目名称:Attack-Of-The-Fines-TA15,代码行数:33,代码来源:Program.cs

示例2: Install

 public void Install(IWindsorContainer container, IConfigurationStore store)
 {
     container.Register(Classes.FromAssemblyContaining<ICreateAutoMapperMaps>().BasedOn<ICreateAutoMapperMaps>().WithServiceAllInterfaces().LifestyleTransient());
     Mapper.Configuration.ConstructServicesUsing(container.Resolve);
     foreach (var map in container.ResolveAll<ICreateAutoMapperMaps>())
         map.CreateMaps();
 }
开发者ID:rjonker1,项目名称:lightstone-data-platform,代码行数:7,代码来源:AutoMapperInstaller.cs

示例3: Install

        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            // register value resolvers
            container.Register(Types.FromAssembly(Assembly.GetExecutingAssembly()).BasedOn(typeof(IValueResolver<,,>)));

            // register profiles
            container.Register(Types.FromThisAssembly().BasedOn<Profile>().WithServiceBase().Configure(c => c.Named(c.Implementation.FullName)).LifestyleTransient());

            var profiles = container.ResolveAll<Profile>();

            var config = new MapperConfiguration(cfg =>
            {
                foreach (var profile in profiles)
                {
                    cfg.AddProfile(profile);
                }
            });

            container.Register(Component.For<MapperConfiguration>()
                .UsingFactoryMethod(() => config));

            container.Register(
                Component.For<IMapper>().UsingFactoryMethod(ctx => ctx.Resolve<MapperConfiguration>().CreateMapper(ctx.Resolve)));

            var mapper = container.Resolve<IMapper>();
            mapper.ConfigurationProvider.AssertConfigurationIsValid();
        }
开发者ID:CoditEU,项目名称:lunchorder,代码行数:27,代码来源:AutoMapperInstaller.cs

示例4: RegisterProfiles

        private void RegisterProfiles(IWindsorContainer container)
        {
            container.Register(AllTypes.FromThisAssembly().BasedOn<Profile>());
            var profiles = container.ResolveAll<Profile>();

            profiles.Each(Mapper.AddProfile);
        }
开发者ID:antgerasim,项目名称:RealWorldMvc,代码行数:7,代码来源:AutoMapperInstaller.cs

示例5: Start

        public void Start()
        {
            container = new WindsorContainer()
                .Install(FromAssembly.InDirectory(new AssemblyFilter(sagaDirectory)));

            var sagas = container.ResolveAll<ISaga>();
            sagas.LogWith(log).InitializeWith(bus);
        }
开发者ID:negy,项目名称:EasyNetQ,代码行数:8,代码来源:WindsorSagaHost.cs

示例6: Configure

 public static void Configure(IWindsorContainer container)
 {
     var handlers = container.ResolveAll<global::AutoMapper.Profile>();
     foreach (var handler in handlers)
     {
         global::AutoMapper.Mapper.AddProfile(handler);
     }
 }
开发者ID:dlidstrom,项目名称:Snittlistan,代码行数:8,代码来源:AutoMapperConfiguration.cs

示例7: QuartzServer

        public QuartzServer(IWindsorContainer container)
        {
            this.logger = LogManager.GetLogger(GetType());
            this.container = container;

            foreach (var registration in container.ResolveAll<IRegisterQuartzJob>())
            {
                Scheduler.ScheduleJob(registration.GetJobDetailToRun(), registration.GetJobTrigger());
            }
        }
开发者ID:modulexcite,项目名称:framework-1,代码行数:10,代码来源:QuartzServer.cs

示例8: RegisterContainer

 private static void RegisterContainer()
 {
     _container = new WindsorContainer();
     _container.Register(
         Classes.FromThisAssembly()
             .Where(x => typeof (IComponentConfiguration).IsAssignableFrom(x))
             .WithServices(typeof (IComponentConfiguration)));
     foreach (var component in _container.ResolveAll<IComponentConfiguration>())
         component.Configure(_container);
 }
开发者ID:Grinderofl,项目名称:ForegroundPing,代码行数:10,代码来源:Program.cs

示例9: Install

        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container
                .Install(new ConfigurationInstaller());

            foreach (var i in container.ResolveAll<IRequiresInitialization>())
            {
                i.Initialize();
            }

            _httpconfiguration.Services.Replace(typeof(IHttpControllerActivator), new WindsorCompositionRoot(container));
        }
开发者ID:CoditEU,项目名称:lunchorder,代码行数:12,代码来源:TestWebInstaller.cs

示例10: Install

        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            DependencyResolver.SetResolver(container.Resolve, type => container.ResolveAll(type).Cast<object>());

            container.Singleton<IDbContextProvider, DbContextProvider>();

            container.Register(
                Types.FromThisAssembly()
                    .Where(type => !type.IsAbstract && type.Name.EndsWith("Manager"))
                    .WithServiceFirstInterface()
                    .LifestyleSingleton());
        }
开发者ID:Apostol59,项目名称:Endowment,代码行数:12,代码来源:InfrastructureProjectWindsorInstaller.cs

示例11: AddConfigurationFromContainer

 public static void AddConfigurationFromContainer(IWindsorContainer container)
 {
     var genericMappers = container.ResolveAll<IGenericMapperMarker>();
     foreach (var mapperImplementation in genericMappers)
     {
         if (Mapper.FindTypeMapFor(mapperImplementation.GetSourceType(), mapperImplementation.GetDestinationType()) == null)
         {
             Mapper.CreateMap(mapperImplementation.GetSourceType(), mapperImplementation.GetDestinationType());
         }
     }
     container.Release(genericMappers);
 }
开发者ID:Detroier,项目名称:playground,代码行数:12,代码来源:AutoMapperConfiguration.cs

示例12: Install

        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container.Register(
                AllTypes
                    .FromThisAssembly()
                    .BasedOn<IModelMetadataFilter>()
                    .WithService.Base()
                    .LifestyleTransient());

            IModelMetadataFilter[] filters = container.ResolveAll<IModelMetadataFilter>();
            ModelMetadataProviders.Current = new CustomModelMetadataProvider(filters);
        }
开发者ID:Gwayaboy,项目名称:iDeal,代码行数:12,代码来源:ModelMetaDataInstaller.cs

示例13: Install

        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            this.Info(() => "Attempting to install AutoMapperInstaller");

            container.Register(Classes.FromAssemblyContaining<ICreateAutoMapperMaps>().BasedOn(typeof(ITypeConverter<,>)).WithServiceAllInterfaces().LifestyleTransient());
            container.Register(Classes.FromAssemblyContaining<ICreateAutoMapperMaps>().BasedOn<ICreateAutoMapperMaps>().WithServiceAllInterfaces().LifestyleTransient());
            Mapper.Configuration.ConstructServicesUsing(container.Resolve);
            foreach (var map in container.ResolveAll<ICreateAutoMapperMaps>())
                map.CreateMaps();

            this.Info(() => "Successfully installed AutoMapperInstaller");
        }
开发者ID:rjonker1,项目名称:lightstone-data-platform,代码行数:12,代码来源:AutoMapperInstaller.cs

示例14: Install

		public void Install(IWindsorContainer container, IConfigurationStore store)
		{
			container.Register(Classes
				.FromThisAssembly()
				.InNamespace("ImageProcessor.Filters")
				.WithServiceAllInterfaces()
				.LifestyleSingleton());

			container.Register(Component
				.For<IFilterBase[]>()
				.Instance(container.ResolveAll<IFilterBase>())
				.LifestyleSingleton());
		}
开发者ID:CyAScott,项目名称:ImageProcessor,代码行数:13,代码来源:EffectsInstaller.cs

示例15: Install

 public void Install(IWindsorContainer container, IConfigurationStore store)
 {
     // Not available in current stable release of AutoMapper
     //Mapper.Initialize(cfg =>
     //{
     //    cfg.BindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
     //});
     container.Register(Classes.FromAssemblyContaining<ICreateAutoMapperMaps>().BasedOn(typeof(ITypeConverter<,>)).WithServiceAllInterfaces().LifestyleTransient());
     container.Register(Classes.FromAssemblyContaining<ICreateAutoMapperMaps>().BasedOn<ICreateAutoMapperMaps>().WithServiceAllInterfaces().LifestyleTransient());
     Mapper.Configuration.ConstructServicesUsing(container.Resolve);
     foreach (var map in container.ResolveAll<ICreateAutoMapperMaps>())
         map.CreateMaps();
 }
开发者ID:rjonker1,项目名称:lightstone-data-platform,代码行数:13,代码来源:AutoMapperInstaller.cs


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