Question

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.

Was it helpful?

Solution

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/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top