Пример #1
0
 public Configuration()
 {
     TargetConfigurations = new Dictionary <Type, TargetConfiguration>(0);
     ValueProviders       = new ValueProvider[]
     {
         new DictionaryValueProvider(),
         new DefaultValueProvider(),
     };
     ValueConverters = new ValueConverter[]
     {
         new EnumValueConverter(),
         new DefaultValueConverter(),
     };
     ValueBinders = new ValueBinder[]
     {
         new IEnumerableValueBinder(this),
         new DefaultValueBinder(this)
     };
 }
Пример #2
0
        /// <summary>
        /// Finds the source enumerable member.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="targetMember"></param>
        /// <param name="targetConfiguration"></param>
        /// <param name="valueProvider"></param>
        /// <returns></returns>
        private static IEnumerable FindSourceEnumerable(object source, IMember targetMember, TargetConfiguration targetConfiguration, ValueProvider valueProvider)
        {
            string name = GetSourceNameOrDefault(targetMember, targetConfiguration);

            if (valueProvider.TryGetValue(source, name, out object sourceValue) && sourceValue is IEnumerable enumerable)
            {
                return(enumerable);
            }

            return(null);
        }