views:

70

answers:

2

I am configing ado.net dataservice in

       public static void InitializeService(IDataServiceConfiguration config)
            {
               // config.UseVerboseErrors = true;
                // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
                // Examples:
                config.SetEntitySetAccessRule("User", EntitySetRights.WriteMerge);
                config.SetEntitySetAccessRule("User", EntitySetRights.WriteReplace);
            }

I have read this link text

but I can't identify the difference between EntitySetRights.WriteMerge and EntitySetRights.WriteReplace

I got my own answer from link text

WriteMerge: In the case of merge-based updates, the payload needs to be an entity and only needs to contain the properties that are being modified. If a property is not included, the value that is currently present in the server will be preserved. Example 14 shows the payload used to update the category that was inserted in the previous example.

WriteReplace: In the case of replace-based updates, the payload needs to be an entity and should contain all the properties of the entity (not including navigation properties). If a property is not included, the value is reset on the server to the default value for the property. This behavior for PUT requests maps to that described in the AtomPub RFC 5023. Example 13 shows the payload used to update the category that was inserted in the previous insert example. Since not all the properties are included in the payload, those not specified will be reset to their default values by the data service.

+2  A: 

Hi,

WriteMerge-Merge-based updates are permitted. WriteReplace-Replacing is permitted

Please take a look at this link. http://msdn.microsoft.com/en-us/magazine/dd569758.aspxlink text

daxsorbito
A: 

Hi Kuoro, In the ADO.NET Data Services server, we define WriteMerge as changing individual properties of an entity. (An example is Changing the FirstName of an Employee Instance.) And WriteReplace as replacing an entity with another entity . ( An example is Changing an Employee by resetting all of the Entity's properties to defaults and then set the properties explicitly .)

With WriteMerge , you can send a request with the MERGE verb to an Entity's endpoint , with WriteReplace , you can send a request with the PUT verb to an Entity's endpoint .

Hope this helps.

Phani Raj