ADO.NET数据服务客户端:AddObject - > SaveChanges - >对象未更新 [英] ADO.NET Data Service Client : AddObject -> SaveChanges -> Object is not updated

查看:116
本文介绍了ADO.NET数据服务客户端:AddObject - > SaveChanges - >对象未更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我正在使用ADO.NET数据服务客户端库。
插入新实体需要返回实体的新副本,包括可能已更新为数据库中触发器的结果。

这在我的情况下不起作用,在触发器中计算二进制数据。此值不会返回。
我正在使用文章 http: //msdn.microsoft.com/en-us/library/cc907912.aspx
作为临时解决方法,我们再次查询实体。

任何帮助表示赞赏。
< br> TIA。
Olivier。

解决方案

你使用什么样的提供者 - 实体框架,Linq To Sql等我不要认为ado .net数据服务在这里有什么特别之处。我的猜测是基础提供商没有刷新实体。如果您正在使用EF,您可以尝试从对象上下文中插入实体,并查看实体是否具有您在触发器中插入的数据。

让我知道您发现了什么。

感谢结果PRATIK

Hello,

I'm using ADO.NET Data Services Client library.
Inserting a new entity is subject to return a fresh copy of the entity including any values that may have been updated as a result of triggers in the database.

This does not work in my case, where a binary data is calculated in a trigger. This value is not returned.
I'm using the code sample number 28 found in the article http://msdn.microsoft.com/en-us/library/cc907912.aspx.
As a temporary workaround, we query the entity again.

Any help appreciated.

TIA.
Olivier.

解决方案

What kind of provider are you using - Entity Framework, Linq To Sql, etc. I don't think ado .net data services does anything special here. My guess would be the underlying provider didn't refresh the entity. If you are using EF, can you try inserting the entity from the object context and see if the entity has the data that you inserted in a trigger.

Let me know what you find out.

Thanks
Pratik


这篇关于ADO.NET数据服务客户端:AddObject - &gt; SaveChanges - &gt;对象未更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆