public ConfigurationData( INameMatcher nameMatcher, IEnumerable <ICompilablePropertyGetterFactory> basePropertyGetterFactories, ConverterFactoryGenerator converterFactoryGenerator, IPropertyGetterFactoryExtrapolator propertyGetterFactoryExtrapolator) { if (nameMatcher == null) { throw new ArgumentNullException("nameMatcher"); } if (basePropertyGetterFactories == null) { throw new ArgumentNullException("basePropertyGetterFactories"); } if (converterFactoryGenerator == null) { throw new ArgumentNullException("converterFactoryGenerator"); } if (propertyGetterFactoryExtrapolator == null) { throw new ArgumentNullException("propertyGetterFactoryExtrapolator"); } NameMatcher = nameMatcher; BasePropertyGetterFactories = basePropertyGetterFactories.ToList().AsReadOnly(); if (BasePropertyGetterFactories.Any(f => f == null)) { throw new ArgumentException("Null reference encountered in basePropertyGetterFactories set"); } ConverterFactoryGenerator = converterFactoryGenerator; PropertyGetterFactoryExtrapolator = propertyGetterFactoryExtrapolator; }
public ExtendableCompilableTypeConverterFactory( INameMatcher nameMatcher, IEnumerable <ICompilablePropertyGetterFactory> basePropertyGetterFactories, ConverterFactoryGenerator converterFactoryGenerator, IPropertyGetterFactoryExtrapolator propertyGetterFactoryExtrapolator) { if (nameMatcher == null) { throw new ArgumentNullException("nameMatcher"); } if (basePropertyGetterFactories == null) { throw new ArgumentNullException("basePropertyGetterFactories"); } if (converterFactoryGenerator == null) { throw new ArgumentNullException("converterFactoryGenerator"); } if (propertyGetterFactoryExtrapolator == null) { throw new ArgumentNullException("propertyGetterFactoryExtrapolator"); } // Record all these settings in a ConfigurationData instance rather than duplicating the check-for-null-property-getter-factories logic here _configurationData = new ConfigurationData( nameMatcher, basePropertyGetterFactories, converterFactoryGenerator, propertyGetterFactoryExtrapolator ); _typeConverterFactory = converterFactoryGenerator(_configurationData.BasePropertyGetterFactories); if (_typeConverterFactory == null) { throw new Exception("Specified converterFactoryGenerator returned null"); } }