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

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

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