Esempio n. 1
0
        /// <summary>
        /// Injects a channel into the current scope, by looking in the parent scope.
        /// This is particularly useful in isolated scopes, to selectively forward channels
        /// </summary>
        /// <param name="name">The name of the channel to create.</param>
        /// <param name="parent">The scope to look in, <code>null</code> means the current parent</param>
        public void InjectChannelFromParent(string name, ChannelScope parent = null)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException(nameof(name));
            }
            parent = parent ?? this.ParentScope;

            lock (__lock)
            {
                var c = parent.RecursiveLookup(name);
                m_lookup[name] = c ?? throw new ArgumentException($"No channel with the name \"{name}\" was found in the parent scope", nameof(name));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Injects a channel into the current scope, by looking in the parent scope.
        /// This is particularly useful in isolated scopes, to selectively forward channels
        /// </summary>
        /// <param name="name">The name of the channel to create.</param>
        /// <param name="parent">The scope to look in, <code>null</code> means the current parent</param>
        public void InjectChannelFromParent(string name, ChannelScope parent = null)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException("name");
            }
            parent = parent ?? this.ParentScope;

            lock (__lock)
            {
                var c = parent.RecursiveLookup(name);
                if (c == null)
                {
                    throw new Exception(string.Format("No channel with the name {0} was found in the parent scope"));
                }

                m_lookup[name] = c;
            }
        }