-
Notifications
You must be signed in to change notification settings - Fork 152
Open
Description
Allow collections to be registered conditional, similar to what Container.RegisterConditional does for non-collection registrations.
e.g.:
container.Collection.RegisterConditional(
serviceType: typeof(ILogger),
serviceTypes: new[] { typeof(SqlLogger), typeof(FileLogger) },
c => c.Consumer.Target.Name.StartsWith("realLoggers"));
container.Collection.RegisterConditional(
serviceType: typeof(ILogger),
serviceTypes: new[] { typeof(ConsoleLogger), typeof(NullLogger) },
c => !c.Handled);The difficulty in this feature is the following:
- It should work for both ambient and flowing scope scenarios
- It should work for all supported collection types