I'm facing a scenario where I'd like to use typed objects, but where the mapping may vary at runtime.
Looking through the documentation I found the config.AddMapping method which allows me to define custom mappings, which works just fine. The only snag is that AddMapping performs a Mapping.GetOrAdd in DirectoryMapper, so once a mapping has been defined, it cannot be changed anymore.
Since I was already in the source code, I quickly changed it so that adding a mapping for a type where a mapping is already known removes it from _mappings before adding a new one (a more proper solution would obviously be to do a _mappings.AddOrUpdate and then return the value so as to not run into a concurrency situation where a new mapping would be created from another thread...
Either way.. do you think it makes sense to add something like that to the mainline code?
I'm facing a scenario where I'd like to use typed objects, but where the mapping may vary at runtime.
Looking through the documentation I found the config.AddMapping method which allows me to define custom mappings, which works just fine. The only snag is that AddMapping performs a Mapping.GetOrAdd in DirectoryMapper, so once a mapping has been defined, it cannot be changed anymore. Since I was already in the source code, I quickly changed it so that adding a mapping for a type where a mapping is already known removes it from _mappings before adding a new one (a more proper solution would obviously be to do a _mappings.AddOrUpdate and then return the value so as to not run into a concurrency situation where a new mapping would be created from another thread...
Either way.. do you think it makes sense to add something like that to the mainline code?