Last post Nov 28, 2008 06:59 AM by colinjack
Nov 20, 2008 10:07 AM|colinjack|LINK
The samples provided with the starter kit were a little over-simplified (and, dare I say it, badly thought through) for my tastes so I wanted to implement this
example from InfoQ.
This example provides a good antidote to the normal CRUD examples but it immediately seemed to have brought me into conflict with your design because I want to have a class like this:
public class OrderCollectionHandler : CollectionServiceBase<Order>, ICollectionService<Order>
However the OnAddItem method would accept a different representation, perhaps
Have you thought about how you want people to do this, so far I've changed the default base class to be:
protected abstract TItem OnAddItem<TRequest>(TRequest creationRequest, out string id);
However this doesn't seem to be working within the constraints of your design so I'm wondering how your starter kit supports these situations?
Nov 26, 2008 04:45 PM|tvish|LINK
Great question. The templates are optimized for collections of a single type that accept a single XML representation. However that's just the template sweet spot - the framework support is full featured. You can use the same template and have a CollectionService<XElement>,
accept multiple representations as XElement and convert to CLR types in your method. Take a look at the UntypedXml sample in the starter kit.
Please let us know if this addresses your scenario.
Nov 28, 2008 06:59 AM|colinjack|LINK
Thanks for replying, your solution might work but I'm thinking that it might be worth focussing on making sure that any solutions you produce can elegantly handle more complex RESTful situations. There aren't many examples but a couple I know of are:
It would be nice if your samples showed how you would implement them, not least as doing that would give you a focus for your efforts.
Just my 2c.