Esempio n. 1
0
        public Context()
        {
            Injector = new Injector();

            Injector.Bind <IInjector>().ToValue(Injector);
            Injector.Bind <IContext>().ToValue(this);

            _configManager = new ConfigManager();
            Injector.Inject(_configManager);
        }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 3
0
 public void Configure()
 {
     Injector.Bind <IEventBus>().ToSingle <EventBus>();
 }
Esempio n. 4
0
 public void Configure()
 {
     Injector.Bind <ICommandMap>().ToSingle <CommandMap>();
 }