Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SimpleInjector-like decorator registering #10

Open
bespoyasov opened this issue Feb 15, 2023 · 0 comments
Open

SimpleInjector-like decorator registering #10

bespoyasov opened this issue Feb 15, 2023 · 0 comments

Comments

@bespoyasov
Copy link

bespoyasov commented Feb 15, 2023

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! :–)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant