SimpleInjector-like decorator registering
bespoyasov opened this issue · 0 comments
bespoyasov commented
Hey!
I was wondering if there's a way to register decorators in a “SimpleInjector-ish” way?
For example, like:
type SomeCommandHandler = CommandHandler<SomeCommand>
class SomeHandler implements SomeCommandHandler { /*...*/ }
class WithLogger implements SomeCommandHandler { /*...*/ }
class WithProfiler implements SomeCommandHandler { /*...*/ }
container.registerSingleton<SomeCommandHandler, SomeHandler>();
container.registerDecorator<SomeCommandHandler, WithLogger>();
container.registerDecorator<SomeCommandHandler, WithProfiler>();
I tried searching the docs and playing with “workarounds” by renaming types for decorators but didn't find anything that would work and look nicely.
P.S. Thanks for the library! :–)