20.06.2011, 22:11 | #1 |
Участник
|
Microsoft Dynamics CRM Team Blog: Issues When Updating Records Using the REST Endpoint for Web Resources and Silverlight
Источник: http://blogs.msdn.com/b/crm/archive/...lverlight.aspx
============== When you update records using Silverlight and the REST Endpoint for Web resources, unless you have worked around this issue you are updating every field even if the data hasn’t changed. This can lead to the following problems:
Issue Description The Microsoft Dynamics CRM SDK documents the following in the topic: Perform Basic Data Operations in Microsoft Dynamics CRM Using the REST Endpoint. This behavior is a result of the way that a Silverlight application project generates proxies to work with an OData service. By default all properties defined for an entity are sent in an update request when you use the DataServiceContext.BeginSaveChanges Method. If you are working with an entity instance that was retrieved from a query it will contain all the current values and saving changes will update all the properties of the entity instance with those values even if they have not changed. If you instantiate a new entity instance and only update a few properties the update will overwrite other properties using the default null value for properties you haven’t set. Technique to Avoid this Problem To address this problem you need to provide some capability in your Silverlight application to track which properties have changed and only submit those properties when you save changes. Michael created the following solution that extends the Data Service Context to include change tracking for entity properties. I’ve found that it is relatively easy to apply this to an existing Silverlight application. Use the following steps to add and edit a new class file to your project: Apply Data Service Context Extensions to A Silverlight Application Project: 1. Add a reference to System.Xml.Linq to your Silverlight application project if it doesn’t already exist4. In the file you created replace the following placeholders with the correct references for your project: 5. Update the Reference.cs file a. In Visual Studio 2010, click the icon with the tooltip Show All Files at the top of the Solution Explorer window.6. Recompile your project, update your Silverlight Web resource with the new .xap file and test it. SDK Update In next release of the SDK (version 5.05) the SDK topic Use the REST Endpoint with Silverlight Web Resources will contain steps include this method. Each of the Silverlight samples that update records will also be updated to include these extensions. Cheers, Jim Daly, Michael Scott Источник: http://blogs.msdn.com/b/crm/archive/...lverlight.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|