将 EntityObject 映射到 POCO 并映射回 WCF RIA 服务会导致重复的子实体
我创建了一个完整的 Visual Studio 2010 解决方案,可以在此处重现该问题:
http://dl。 dropbox.com/u/42317133/WcfRiaAutoMapper.zip
- 构建解决方案。
- 在测试项目中运行单元测试来部署数据库。
- 调试 SilverlightApplication1 项目
- 单击“Click me”按钮。
- 请注意,当只需要一名作者时,却将两名作者添加到作者数据库表中。
在“RIAServicesLibrary1.Web”项目中的BlogService.cs 中的InsertPost 方法映射期间存在问题。
如果我注释掉这两行,那么它就会按预期工作。
有什么想法吗?
AutoMapper 1.1 和 AutoMapper 2.0.0 都会发生这种情况,
非常感谢。
这是此处提交的问题的重新发布:
https://github.com/AutoMapper/AutoMapper/issues/165
I created a complete Visual Studio 2010 solution that can reproduce the issue here:
http://dl.dropbox.com/u/42317133/WcfRiaAutoMapper.zip
- Build the solution.
- Run the unit test in the test project to deploy the database.
- Debug the SilverlightApplication1 project
- Click on the "Click me" button.
- Notice that two Authors are added to the Authors database table when only one was expected.
The problem exists during the mapping in the InsertPost method in BlogService.cs in the "RIAServicesLibrary1.Web" project.
If I comment those two lines out, then it works as expected.
Any ideas?
This happens with both AutoMapper 1.1 and AutoMapper 2.0.0
Thank you very much.
This is re-post of the issue submitted here:
https://github.com/AutoMapper/AutoMapper/issues/165
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我终于能够通过使用 UseDestinationValue 成员选项解决此问题,如下所示:
I was finally able to resolve this by using the UseDestinationValue member option as follows: