Replies: 9 comments 2 replies
-
I also wanted to add that when adding a convertUsing configuration, providing the source value does not have intellisense. |
Beta Was this translation helpful? Give feedback.
-
@HurricaneDancer How about try to implement this feature yourself and create am PR? |
Beta Was this translation helpful? Give feedback.
-
@HurricaneDancer I am currently on vacation. I'll take a look as soon as I'm back. |
Beta Was this translation helpful? Give feedback.
-
@HurricaneDancer so you would like to see a pre-defined converters exported from AutoMapper? Would you be able to provide a list of what you'd like to see? |
Beta Was this translation helpful? Give feedback.
-
@nartc not pre defined ones, but the ability to configure default converters by type. So if I have a Date type, I would want to make a converter that returns Date.valueOf. Then automappers default behavior for the date type is to convert it to the valueOf. Hopefully that makes sense |
Beta Was this translation helpful? Give feedback.
-
@HurricaneDancer Like TypeConverter from .NET AutoMapper? That one is going to be hard 😝 mainly because of TypeScript Reflection capability. But I'll think about it, at least for primitive types like |
Beta Was this translation helpful? Give feedback.
-
@HurricaneDancer give v6.0.0 a try. Documentations are here https://automapperts.netlify.app/docs/mapping-configuration/custom-type-converter |
Beta Was this translation helpful? Give feedback.
-
@HurricaneDancer I’ve just noticed you have different naming conventions as well which I didn’t test if type converters work with naming conventiond yet. Feel free to let me know if it works. |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
I am finding myself having to specifically create a convertUsing mapper for a Date object. It would be really nice if there were defaults for converters.
Describe the solution you'd like
probably a defaultConverters object in the mapper options keyed by type (string, date, number etc)
Describe alternatives you've considered
An alternative could be creating a custom plugin, but it would be nice to have this as a default option as it will happen in multiple projects.
Additional context
Beta Was this translation helpful? Give feedback.
All reactions