本文整理汇总了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();
}
示例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();
}
示例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();
}
示例4: RegisterProfiles
private void RegisterProfiles(IWindsorContainer container)
{
container.Register(AllTypes.FromThisAssembly().BasedOn<Profile>());
var profiles = container.ResolveAll<Profile>();
profiles.Each(Mapper.AddProfile);
}
示例5: Start
public void Start()
{
container = new WindsorContainer()
.Install(FromAssembly.InDirectory(new AssemblyFilter(sagaDirectory)));
var sagas = container.ResolveAll<ISaga>();
sagas.LogWith(log).InitializeWith(bus);
}
示例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);
}
}
示例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());
}
}
示例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);
}
示例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));
}
示例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());
}
示例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);
}
示例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);
}
示例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");
}
示例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());
}
示例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();
}