Beispiel #1
0
        /// <exclude />
        public void AddService(IFlowControllerService flowControllerService)
        {
            Type type = flowControllerService.GetType();

            foreach (Type interfaceType in type.GetInterfaces())
            {
                List <object> list = _services.GetOrAdd(interfaceType, () => new List <object>());

                list.Add(flowControllerService);
            }
        }
Beispiel #2
0
        /// <exclude />
        public void RemoveService(IFlowControllerService flowControllerService)
        {
            Type type = flowControllerService.GetType();

            foreach (Type interfaceType in type.GetInterfaces())
            {
                if (!_services.TryGetValue(interfaceType, out var list))
                {
                    throw new InvalidOperationException();
                }

                list.Remove(flowControllerService);
            }
        }
        /// <exclude />
        public void AddService(IFlowControllerService flowControllerService)
        {
            Type type = flowControllerService.GetType();

            foreach (Type interfaceType in type.GetInterfaces())
            {
                List <object> list;

                if (_services.TryGetValue(interfaceType, out list) == false)
                {
                    list = new List <object>();

                    _services.Add(interfaceType, list);
                }

                list.Add(flowControllerService);
            }
        }