views:

162

answers:

1

From the documentation that I have read so far, ADO.Net data services is positioned as way of exposing a CRUD like interface to tables in a database in a RESTful way. This is great for applications that only do those four operations, but what about applications that do more?

What about verbs like Print, Approve, Submit, Copy, Transfer, Process, Calculate.

The common approach in RESTful applications is to create new resources that can be interacted with to perform these additional requests. e.g. Create a Printer resource that can be posted to perform a print operation. However, these resources do not necessarily map to tables or views in the database.

How does ADO.Net Data Services handle these resources that do not map to a table? As an example let's say you were calculating payroll and you created a endpoint /PayrollService/PayCalculator. POSTing an entity which contains some employee information and their gross pay would instruct the PayCalculator resource to return the employees benefits and deductions.

A: 

Data Services can expose "any" object graph that you implement IQueryable on and optionally IUpdateable. The objects don't need to in any way be mapped to the db. This should do what you are looking for. Check out this 15min video http://channel9.msdn.com/posts/mtaulty/ADONET-Data-Services-VS08-Sp1-B1-Surfacing-Data/

You can also implement service operations - methods if you like. Ok - not so RESTful but handy and easy to do. Check out this 7min video http://channel9.msdn.com/posts/mtaulty/ADONET-Data-Services-VS08-Sp1-B1-Service-Operations/

Eric Nelson
I've seen the service operation method and that seemed to be just dropping back to a standard WCF interface. As you say, not very RESTful.
Darrel Miller
I watched the video and I can see the possibilities. However, being forced into creating an EntitySet and an Entity that has a key would twist my PayrollCalculator example pretty badly. I can see the value of ADO.Net data services, it just doesn't work well for my scenario.
Darrel Miller