public IExcelMapper Build(IWorkbook workbook, MapperSettings settings) { if (workbook == null) { throw new ArgumentNullException(nameof(workbook)); } if (settings == null) { throw new ArgumentNullException(nameof(settings)); } IConverterProvider converterProvider = GetDefaultConvertersProvider(); IPropertyNameConvention propertyNameConvention = GetDefaultPropertyNamingConventions(); if (settings.Convention.AnyValue()) { propertyNameConvention = settings.Convention; } if (settings.ConverterProvider.AnyValue()) { converterProvider = settings.ConverterProvider; } var propertiesExtractor = new TypeInfoProvider(); var propertyInfoExtractor = new PropertyInfoExtractor(); var propertiesMapFactory = new ExcelPropertyMapFactory(propertiesExtractor, propertyInfoExtractor, propertyNameConvention, _loggerFactory.CreateLogger <ExcelPropertyMapFactory>()); var typeConverter = new CellValueConverter(converterProvider); var modelFactory = new ModelBuilder(propertyInfoExtractor); return(new ExcelMapper(workbook, propertiesMapFactory, typeConverter, modelFactory, _loggerFactory.CreateLogger <ExcelMapper>())); }
public ExcelPropertyMapFactory(ITypeInfoProvider propertiesExtractor, IPropertyInfoExtractor propertyInfoExtractor, IPropertyNameConvention conventionsApplier, ILogger <ExcelPropertyMapFactory> logger) { _propertiesExtractor = propertiesExtractor ?? throw new ArgumentNullException(nameof(propertiesExtractor)); _propertyInfoExtractor = propertyInfoExtractor ?? throw new ArgumentNullException(nameof(propertyInfoExtractor)); _conventionsApplier = conventionsApplier ?? throw new ArgumentNullException(nameof(conventionsApplier)); Log = logger ?? throw new ArgumentNullException(nameof(logger)); }
public ColumnSelectorByConvention(string valueToFind, IPropertyNameConvention convention, StringComparison options) { _valueToFind = valueToFind; _convention = convention ?? throw new ArgumentNullException(nameof(convention)); _options = options; if (string.IsNullOrEmpty(valueToFind)) { throw new ArgumentException("Argument is null or empty", nameof(valueToFind)); } if (string.IsNullOrWhiteSpace(valueToFind)) { throw new ArgumentException("Argument is null or whitespace", nameof(valueToFind)); } if (!Enum.IsDefined(typeof(StringComparison), options)) { throw new ArgumentOutOfRangeException(nameof(options)); } }
public CurieLinkJsonConvertor(IPropertyNameConvention propertyNameConvention) { this.propertyNameConvention = propertyNameConvention; }
public ColumnSelectorByConvention(string valueToFind, IPropertyNameConvention convention) : this(valueToFind, convention, StringComparison.CurrentCulture) { }
private void LogConventionApplied(string nameToApplyConvetionTo, IPropertyNameConvention convention) { Log.LogDebug("Naming convention {0} was applied successfully. The resulting name is '{1}'.", convention.GetType().Name, nameToApplyConvetionTo); }
private void LogApplyingConvention(string nameToApplyConvetionTo, IPropertyNameConvention convention) { Log.LogDebug("Applying {0} naming convention to '{1}' ...", convention.GetType().Name, nameToApplyConvetionTo); }
public HalGraphJsonConvertor(IPropertyNameConvention propertyNameConvention) { this.propertyNameConvention = propertyNameConvention; }
public static IColumnSelector ByConvention(string value, IPropertyNameConvention convention, StringComparison options) { return(new ColumnSelectorByConvention(value, convention, options)); }
public static IColumnSelector ByConvention(string value, IPropertyNameConvention convention) { return(new ColumnSelectorByConvention(value, convention)); }