public Context() { Injector = new Injector(); Injector.Bind <IInjector>().ToValue(Injector); Injector.Bind <IContext>().ToValue(this); _configManager = new ConfigManager(); Injector.Inject(_configManager); }
public void Add <TK>() { var type = typeof(TK); if (!typeof(ICommand <T>).IsAssignableFrom(type)) { throw new ArgumentException($"{type.FullName} is being mapped as a command but does not implement {nameof(ICommand<T>)}"); } _commandTypes.Add(type); if (!Injector.IsBound <TK>()) { Injector.Bind <TK>().AsSingle(); } if (_commandTypes.Count == 1) { EventBus.Subscribe <T>(OnEvent); } }
public void Configure() { Injector.Bind <IEventBus>().ToSingle <EventBus>(); }
public void Configure() { Injector.Bind <ICommandMap>().ToSingle <CommandMap>(); }