/// <summary>
 /// Adds the specified parameter set to the pool.
 /// </summary>
 /// <param name="creator">The entity identifier to which the parameter set belongs.</param>
 /// <param name="parameters">The parameter set.</param>
 public void Add(string creator, ParameterSet parameters)
 {
     if (!_entityParameters.TryGetValue(creator, out var ep))
     {
         ep = new ParameterSetDictionary();
         _entityParameters.Add(creator, ep);
     }
     ep.Add(parameters);
 }
Exemple #2
0
        /// <summary>
        /// Copy all parameter sets.
        /// </summary>
        /// <param name="source">The source object.</param>
        public virtual void CopyFrom(ParameterSetDictionary source)
        {
            var d = source as ParameterSetDictionary ?? throw new CircuitException("Cannot copy, type mismatch");

            foreach (var ps in d.Values)
            {
                // If the parameter set doesn't exist, then we will simply clone it, else copy them
                if (!TryGetValue(ps.GetType(), out var myps))
                {
                    Add(ps.Clone());
                }
                else
                {
                    Reflection.CopyPropertiesAndFields(ps, myps);
                }
            }
        }