简体   繁体   中英

C# - How to make AutoMapper case insensitive?

I found that the mapping is a case sensitive mapping from IDataReader which is a bummer as the database fields are all lower case and the POCOs are CamelCase .

I found this post by Jimmy, Is AutoMapper case sensitive or insensitive? ...

Is there a magic switch somewhere?

开箱即用是不可能的

I think you can control this in Mapper.Initialize as the answer and solutions posted here seem to suggest: AutoMapper: Mapping between a IDataReader and DTO object

Here is another good post with examples on naming convention mappings: http://blog.ac-graphic.net/automapping-c-objects-from-one-naming-convention-to-an-other/

Does that help?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM