Friday, April 9, 2010

Open Data Protocol Visualizer

Microsoft Open Data Protocol Visualizer (CTP1) provides a read-only graphical view of the types and relationships provided by a WCF Data Service . WCF Data service uses OData protocol to expose the Data as Restful Service .

Here is the Link where you can download the OData Visualizer.

http://visualstudiogallery.msdn.microsoft.com/en-us/f4ac856a-796e-4d78-9a3d-0120d8137722.

After installing. some time you may need to enable the OData Visualzier. To do go to Tools ( VS.NET 2010 IDE) and select Extension Manger then select OData Visualizer

and Click Enable and restart your VS.NET IDE.

image

In order to use OData Visualizer we need to have WCF Data Service Reference in your project. so let us create our own  WCF Data Service.

First Create ASP.NET Web Application and Add WCF Data Service Template.

image 

Next we need to add or select the Data Source which we are going to Expose as  WCF Data Service. Here I am going to use one of the Free Database from CodePlex site the DB called Chinook.  Next we are going to use ADO.NET Entity Data Model to create our Data model. 

image

    Now Just follow the Wizard and create your Data Model .

image

     Now open .SVC Service file and edit Data entity and set Entity Access Rule as shown below . Here I am exposing all Entity with All Access Rights.

     Here is the list of Access Rights we can set  

 image

image

      Now compile the project and Browse the Service in IE .

image

Now our WCF Data service ready now we need client project to consume. Let us add another Project, here I am going to use console application as client for WCF Data Service for the demo purpose to  show how to use OData Visualzier.

image 

Now we need to add  WCF Data Service Reference to console application client  project.

image 

After adding Service Reference. Now right click on added Service reference and select View in Diagram. 

image

Now click Open Data Protocol Model Browser link on Design surface and drag and drop the Entity to the Design surface or you can right click and select Show in Diagram as well.

image

image[78]

  In OData Model Browser shows all the aspects of the WCF Data service.

image

 

Here is the another view  where you can see only Entity Names and it relations.

image

 

image

Netflix has partnered with Microsoft to create an OData API for the Netflix catalog information. here is the Here is the link for NetFlix OData protocol   http://odata.netflix.com/Catalog/.

Let us add Netflix service to our client project and view with OData Visualizer.

image

 

image

This OData Visualizer help us to understand Entity relations and their different aspects. There is option to export this Diagram as XPS file format as well.

Nandri(Thanks)

SreenivasaRagavan.

No comments: