예제 #1
0
        /// <summary>
        /// Constructs the Unity overrides based on the local DependencyOverride
        /// </summary>
        /// <param name="parameters">The paramters data to override</param>
        private Unity.CompositeResolverOverride BuildUnityOverrides(params DependencyOverride[] parameters)
        {
            var overrides = new Unity.CompositeResolverOverride();

            parameters.ForEach(x =>
            {
                if (!string.IsNullOrWhiteSpace(x.DependencyName))
                {
                    overrides.Add(new Unity.ParameterOverride(x.DependencyName, x.DependencyValue));
                }
                else
                {
                    overrides.Add(new Unity.DependencyOverride(x.DependencyType, x.DependencyValue));
                }
            });

            return(overrides);
        }
예제 #2
0
 /// <summary>
 /// Add a new override to the collection with the given key and value.
 /// </summary>
 /// <param name="key">Key - for example, a parameter or property name.</param>
 /// <param name="value">Value - the value to be returned by the override.</param>
 public void Add(TKey key, TValue value)
 {
     overrides.Add(MakeOverride(key, value));
 }