DryIoc icon indicating copy to clipboard operation
DryIoc copied to clipboard

Feature Request: add global .WithDefaultServiceTypeCondition(Func<Type, bool> condition) method

Open ChaseFlorell opened this issue 1 year ago • 1 comments

Given the global Rules support within DryIoc, I would like to see an option to add a default serviceTypeCondition for all of my RegisterMany calls.

var container = new Container(Rules.Default
                                   .WithDefaultServiceTypeCondition(type => type.IsInterface))

The default behavior can still be ImTools Fun.Always when this method isn't overridden, but this would give us the ability to apply the same configuration across the entire application without the explicit need to call it on every registration.

ChaseFlorell avatar Apr 09 '24 14:04 ChaseFlorell

@ChaseFlorell Thanks for suggestion.

I think we need more RegisterMany targeted thingy, e.g. WithRegisterManyRules(serviceTypeConditon: t => t.IsInterface). So we keep the door open to extend it later.

dadhi avatar Apr 10 '24 09:04 dadhi