@@ -23,20 +23,20 @@ import { ICanBuildAndRegisterAnEventHandler } from './ICanBuildAndRegisterAnEven
2323
2424export class EventHandlerClassBuilder < T > extends ICanBuildAndRegisterAnEventHandler {
2525 private readonly _eventHandlerType : Constructor < T > ;
26- private readonly _getInstance : ( container : IContainer ) => T ;
26+ private readonly _getInstance : ( container : IContainer , executionContext : ExecutionContext ) => T ;
2727
2828 constructor ( typeOrInstance : Constructor < T > | T ) {
2929 super ( ) ;
3030 if ( typeOrInstance instanceof Function ) {
3131 this . _eventHandlerType = typeOrInstance ;
32- this . _getInstance = container => container . get ( typeOrInstance ) ;
32+ this . _getInstance = ( container , executionContext ) => container . get ( typeOrInstance , executionContext ) ;
3333
3434 } else {
3535 this . _eventHandlerType = Object . getPrototypeOf ( typeOrInstance ) . constructor ;
3636 if ( this . _eventHandlerType === undefined ) {
3737 throw new CannotRegisterEventHandlerThatIsNotAClass ( typeOrInstance ) ;
3838 }
39- this . _getInstance = _ => typeOrInstance ;
39+ this . _getInstance = ( ) => typeOrInstance ;
4040 }
4141 }
4242
@@ -104,7 +104,7 @@ export class EventHandlerClassBuilder<T> extends ICanBuildAndRegisterAnEventHand
104104 return ( event , eventContext ) => {
105105 let instance : T ;
106106 try {
107- instance = this . _getInstance ( container ) ;
107+ instance = this . _getInstance ( container , eventContext . executionContext ) ;
108108 } catch ( ex ) {
109109 throw new CouldNotCreateInstanceOfEventHandler ( this . _eventHandlerType , ex ) ;
110110 }
0 commit comments