开发者

Automapper: change map behavior based on presence of custom attribute

开发者 https://www.devze.com 2023-01-27 11:11 出处:网络
Is it possible to have开发者_运维百科 AutoMapper look for an attribute on the source property?I want AutoMapper to change how it maps the properties when those properties have a specific attribute set

Is it possible to have开发者_运维百科 AutoMapper look for an attribute on the source property? I want AutoMapper to change how it maps the properties when those properties have a specific attribute set.


There's nothing out of the box that allows you to do this. You will need to use reflection to read attributes for a given property and based on it's value adapt the mapping.

0

精彩评论

暂无评论...
验证码 换一张
取 消