Skip to content

SimpleInjector-like decorator registering #10

@bespoyasov

Description

@bespoyasov

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions