ExcelToEnumerable
ExcelToEnumerable copied to clipboard
Add overload for Property mapping using MemberInfo
@ChrisHodges - Can you take a look at this PR when you get a chance?
I have a use case where I don't know the Type that is being hydrated from the Excel file, but I am relying on some other source for the column mapping (a custom attribute that I'm using for mapping from csv and xlsx using separate libraries)
foreach ( PropertyInfo propertyInfo in typeof( T ).GetProperties( BindingFlags.Instance | BindingFlags.Public ) )
{
if ( propertyInfo.GetCustomAttribute<ColumnMap>() is not { } columnMap ) continue;
opts.Property( propertyInfo ).MapsToColumnNamed( columnMap.Name );
}
I've included tests, and all tests are passing.