Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapping dictionary #72

Open
ghendric opened this issue Jun 16, 2021 · 2 comments
Open

Mapping dictionary #72

ghendric opened this issue Jun 16, 2021 · 2 comments

Comments

@ghendric
Copy link

I'm trying to map a dictionary list to a column in a class and for the most part its working but the WithInvalidFallBack functionality doesn't seem to be working correctly. If a key is found in the dictionary list, i'm getting the correct value but if its not found, i'm getting the key back as the value instead of what i'm passing to WithInvalidFallBack. Shouldn't I be getting back the fallback value?

@ghendric
Copy link
Author

ghendric commented Jul 23, 2021

(tap, tap, tap)Hello? is this thing on? lol

I'm kind of stuck on this at the moment and was wondering if anyone has taken a look at this? Also, are there any instructions on how to use these cool extensions? Specifically with the fallback methods that I can't seem to figure out or get to work.

EX:
var employeeMap = Dictionary<string,string>();
employeeMap.Add("John Doe", "12345");
var fallbackValue ="Missing";
Map(x => x.EmployeeID).WithMapping(employeeMap).WithColumnIndex(columnIndex).WithInvalidFallback(fallbackValue);

Instead of EmployeeID getting set to the word "Missing", it gets set to the actual Key value of "John Doe" if WithInvalidFallback cant match a key from the mapping. I'm not sure I'm using this correctly. Any help is greatly appreciated.

"John Doe" is the key

@ghendric
Copy link
Author

ghendric commented Jul 23, 2021

*** UPDATE
I discovered that if the first cell value mapper is removed, then i get the results that i am expecting.

EX:
Map(x => x.EmployeeID).WithMapping(employeeMap).WithColumnIndex(columnIndex).WithInvalidFallback(fallbackValue).RemoveCellValueMapper(0);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant