Saturday, December 13, 2008

ADO.NET Data Services -Adding Service Operations

 

I am going to use  Northwind Database as my Data source

ED conceptual model of  Northwind database.

image

 

Here is the list of Northwind ED exposed as data collections in  ATOM based . now we can access each collection as URI

for example.

http://localhost:53133/NWebDataService.svc/Customers - To access customers data

http://localhost:53133/NWebDataService.svc/Orders  -To access Orders data. 

image

Now we are going to add few service Operations into existing Data service. to add Service operations we need to use WCF 3.5: WebGet Attribute.

Here I added two service Operations GetCustomerbyCity , GetOrdersByCustomerId as shown below.

 

 

image

Now we are able to browse the Methods as shown below.

http://localhost:53133/NWebDataService.svc/GetOrdersByCustomerId?customerId='ALFKI'

 

  image

 

Thanks

SreenivasaRagavan

No comments: