5

I am still confused of when to use Value Formatter versus Value Resolver in automapper.

Say I have a nullable DateTime that I want to make into a specific date format(so the end result would be a string). Should I use Formatter in this case?

Thanks

chobo2
  • 83,322
  • 195
  • 530
  • 832

1 Answers1

3

I had the same question and chose Value Resolver based upon documentation from the author himself that Value Formatter is likely a design mistake:

https://github.com/AutoMapper/AutoMapper/wiki/Custom-value-formatters

However, that same author provided a response to what to use when here:

Why does AutoMapper have an IValueFormatter when it has a seemingly much more powerful ValueResolver?

Community
  • 1
  • 1
Shawn
  • 1,871
  • 2
  • 21
  • 36