pre { /*控制代码不换行*/ white-space: pre; word-wrap: normal; }

坑:automapper 中的null值映射

今天在做对象映射的时候提示我

 

Mapping types:
ArticleServiceModel._id -> String               (此处为null)
ServiceModel.Sina.ServiceModel.ArticleServiceModel -> System.String

Destination path:
T_Article._id                                             (此处有值)

Source value:
ServiceModel.Sina.ServiceModel.ArticleServiceModel

 

从上面可以定位是2个对象的T_Article中的_id,与 ArticleServiceModel中的映射出了问题,经过反复排查与调试最终发现是null值与有值的字段进行映射导致的,

在获取原始对象的时候没有对_id进行赋值,致使在mapper的时候出现了上述问题,特此记录一下

posted @ 2016-05-19 10:42  monkey's  阅读(1636)  评论(0)    收藏  举报