-
Notifications
You must be signed in to change notification settings - Fork 39
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
Mapper not using custom Guid map #29
Comments
Tests:
with the following CustomerNew
|
when you call instead you are calling if you need to map from guid to string throughout your application you can create a ValueInjection (https://github.com/omuleanu/ValueInjecter/wiki/custom-injections-examples) that will do that and use it in each map you need, or create one map use it in it, and set that map as the default: https://github.com/omuleanu/ValueInjecter#default-map |
yeah I just debugged the MapperInstance code and saw it. However, it kinda makes sense to register such a map application-wide because if I introduce a custom value injection (which I've been doing ever since VI came out) I have to always use it with InjectFrom. I can see there's an option to change the default injection but again that introduces issues if later on we need another custom mapping for a different type. Maybe I should add mappings like this one to the DefaultMap? |
you have multiple options, you can use your injection only in the maps you need it to be used, or instead of using the default static mapper, you create multiple instance mappers where you can also change the default map and use them instead. |
What happens if I have this Guid->string mapping and later on need DateTime->string and so on? How would that look like in the DefaultMap implementation, like this:
Doesn't look nice to me, I'd rather have an option to provide an array of value injections to use OR use the maps (which are perfect for that). |
In asp.net core app within Configure method of Startup class I have
which doesn't get used when calling Mapper.Map()
response.Items = docs.Select(d => Mapper.Map<DocumentSearchViewResponse>(d));
The corresponding string properties that should be filled with string representation of Guid are empty/null.
The text was updated successfully, but these errors were encountered: