private ModuleConnectionConfigurator GetOrCreateConfigurator(object channelId)
        {
            ModuleConnectionConfigurator moduleConnectionConfigurator = null;

            if (!_configuratorsByChannel.TryGetValue(channelId, out moduleConnectionConfigurator))
            {
                moduleConnectionConfigurator = _configuratorsByChannel[channelId] = CreateConfigurator(channelId);
            }
            return(moduleConnectionConfigurator);
        }
        /*============================================================================*/
        /* Private Functions                                                          */
        /*============================================================================*/

        private void Destroy()
        {
            object[] configuratorsByChannelKeys = new object[_configuratorsByChannel.Keys.Count];
            _configuratorsByChannel.Keys.CopyTo(configuratorsByChannelKeys, 0);

            foreach (object channelId in configuratorsByChannelKeys)
            {
                ModuleConnectionConfigurator configurator = _configuratorsByChannel[channelId];
                configurator.Destroy();
                _configuratorsByChannel.Remove(channelId);
            }

            _configuratorsByChannel = null;
            _localDispatcher        = null;
            _rootInjector           = null;
        }
 public void Setup()
 {
     subject = new ModuleConnectionConfigurator(localDispatcher.Object, channelDispatcher.Object);
 }