Automapper表映射表0..1-*关系
我一直在我们的项目中使用 Automapper,最近遇到了一个以前没有遇到过的问题。
当我尝试映射的表具有 0..1 TO * 关系时,Automapper 不会执行映射。
我尝试检查和更改 CreateMap 调用,并且 .ForMember(..) 的 lambda 表达式不允许我访问 tableObject 的属性。
有人能指出我在这方面的正确方向吗?
我检查了另一个我没有尝试在我们的模型中使用的表,它也是 0..1 TO 1 并注意到同样的问题。
谢谢,
维克多
编辑: 发现问题...这两个类恰好设置错误。它们是公共的,但没有任何公共属性(所有属性都省略了 public 关键字)。
我试图提供答案,但在 << 中没有足够的自我回答声誉。 8小时。
谢谢, 胜利者
I have been using Automapper in our projects and just recently ran into an issue not previously encountered.
When the table I am trying to Map has a 0..1 TO * relationship Automapper is not performing the mapping.
I tried examining and altering the CreateMap call and the lambda expression of the .ForMember(..) is not allowing me to access the tableObject's properties.
Can someone point me to the right direction on this?
I checked another table that I hadn't tried using in our model which is also 0..1 TO 1 and noticed the same problem.
Thanks,
Victor
EDIT:
Found the issue... the two classes were coincidentally incorrectly setup. They were public but didn't have any public properties (the public keyword was ommitted for all properties).
I tried to provide an answer but don't have enough reputation for self-answer in < 8hrs.
Thanks,
Victor
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
发现问题...这两个类恰好设置错误。它们是公共的,但没有任何公共属性(所有属性都省略了 public 关键字)。
我试图提供答案,但在 << 中没有足够的自我回答声誉。 8小时。
谢谢,维克多
Found the issue... the two classes were coincidentally incorrectly setup. They were public but didn't have any public properties (the public keyword was ommitted for all properties).
I tried to provide an answer but don't have enough reputation for self-answer in < 8hrs.
Thanks, Victor