Hello,
I'm starting a new project and want to take an approach of WebAPI REST architecture (in combination with a WPF smartclient)
To maximally leverage LLBLGen, i would use the adapter model, and reuse the DatabaseGeneric classes in backend as well as in the WPF client, using the JSON serialization to communicate with the WebAPI backend as Frans explained in his blog a while ago (http://weblogs.asp.net/fbouma/how-to-make-asp-net-webapi-serialize-your-llblgen-pro-entities-to-json)
I'm still a bit struggling with the following scenario:
Imagine the classic User-Orders-Orderlines-Products entity model and a UI where the end-user can edit a grid with orderlines after choosing a user and order.
The webAPI api would be something like :
GET api/users <- get all users
GET api/users/123 <- get user with id 123 (with prefetched orders !)
GET api/orders/123 <- get the order with id 123 (with prefeteched orderlines and products !)
So far so good, it would get deserialized in the client and data-bound to listboxes or grids or whatnot.
But what about sending modified data back ? When the end-user for example requests an order + details (GET api/Orders/123) to open in a fancy WPF OrderDetailsEditView.xaml and changes in a grid an "amount" field on an orderline and presses "save" to save the modified order, the whole Order-entity object graph would be serialized and send back to the api (PUT api/Orders/123).
This seems like a bit of overhead. Is there a better way to send only the modified entities back to the server ? Or for instance "cut off" some parts of the object graph, like the "products" entities, those might be prefetched when requesting the Order-details (because for instance a productname should be displayed in an orderline in a grid), but I don't want to serialize those Product-entities and send back to the server when just modifiyng some amount on an orderline, or some remark on the order-entity itself.
Thanks for any remarks !