How to give default mapping of enum to string using AutoMapper?

Viewed 2205

Supposing I have two types: MyEnum and string, I can create a mapping like

Mapper.Initialize(cfg => cfg.CreateMap<MyEnum, string>().ConvertUsing(src => src.ToString()));

but can I tell AutoMapper to map any enum to string by calling .ToString()?

Since if I have like 100 enum types and I want to convert all of them to strings by calling ToString(), I have to add 100 new lines of code.

1 Answers
Related