Partial Updates OpenRasta

18 views
Skip to first unread message

Prashant

unread,
Nov 15, 2011, 11:55:49 PM11/15/11
to OpenRasta
Hi,

I am new to OpenRasta and currently looking for any way of supporting
partial updates for resource.I want to know whether OpenRasta support
HTTP PATCH method or not ?? or there is any other way of doing this.


Thanks,
Prashant

Sebastien Lambla

unread,
Nov 21, 2011, 7:42:06 AM11/21/11
to open...@googlegroups.com
public class MyHandler{
public object Patch(string name = null){
}
}
What are you looking for exactly?
________________________________________
From: open...@googlegroups.com [open...@googlegroups.com] on behalf of Prashant [prashant...@gmail.com]
Sent: 16 November 2011 04:55
To: OpenRasta
Subject: [openrasta] Partial Updates OpenRasta

Bob Gregory

unread,
Nov 23, 2011, 4:38:03 AM11/23/11
to open...@googlegroups.com
There's a ChangeSet<T> that updates objects based on some patch format, but I've not used it personally.

I believe it gives you a set of key-value pairs which will be applied to your object as the result of a PATCH operation.

 -- B
--
Q. How many members of a demographic group does it take to perform a specified task?

A. A finite number; one to perform the task, and the remainder to act in a manner stereotypical of the group in question.

prashant alhat

unread,
Nov 24, 2011, 12:48:04 AM11/24/11
to open...@googlegroups.com
Can you give me some references from where i can read about these ChangeSet<T> in details? It will be very useful.

Sebastien Lambla

unread,
Nov 24, 2011, 3:45:48 AM11/24/11
to open...@googlegroups.com
 ChangeSet<T> can be used as a parameter in your handler methods, provided you use a key/value codec (html forms, but not json or xml).

You can then just call Apply(T target) on it and it'll update just the changes that were submitted.

Adding support for json or xml media types would require new codecs to be biult that support spitting out key/value pairs from the input. It's not undoable, just awkward to build.



From: open...@googlegroups.com [open...@googlegroups.com] on behalf of prashant alhat [prashant...@gmail.com]
Sent: 24 November 2011 05:48
To: open...@googlegroups.com
Subject: Re: [openrasta] Partial Updates OpenRasta

Bob Gregory

unread,
Nov 24, 2011, 6:01:07 AM11/24/11
to open...@googlegroups.com
Am I right in thinking that it would be reasonably straight-forward to implement an patch format so long as you don't use nested data structures?

ie..

public class Customer
{
  string FirstName {get; set;}
  string LastName { get; set;}
  int Age { get; set;}

  public Pet Pet { get; set; }
}

public class Pet
{
   string Name { get; set;}
   Species Species { get; set; }
}


With a bit of twiddling, you can create a key-valued codec from XML and set your firstname/lastname/age parameters in a straightforward way

PATCH /customers/1234

<Customer>
  <Age>11</Age>
</Customer>


But supporting more complex data structures (like the nested Pet property) is a longer job.

Sebastien Lambla

unread,
Nov 24, 2011, 10:15:22 AM11/24/11
to open...@googlegroups.com
 Yeap, indeed why I think at some stage providing a new xml codec would be invaluable, at some point.

From: open...@googlegroups.com [open...@googlegroups.com] on behalf of Bob Gregory [patho...@gmail.com]
Sent: 24 November 2011 11:01
Reply all
Reply to author
Forward
0 new messages