{"id":1553,"date":"2009-11-17T11:36:00","date_gmt":"2009-11-17T11:36:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/odatateam\/2009\/11\/17\/introducing-the-microsoft-open-data-protocol-visualizer-ctp1\/"},"modified":"2009-11-17T11:36:00","modified_gmt":"2009-11-17T11:36:00","slug":"introducing-the-microsoft-open-data-protocol-visualizer-ctp1","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/odata\/introducing-the-microsoft-open-data-protocol-visualizer-ctp1\/","title":{"rendered":"Introducing the Microsoft Open Data Protocol Visualizer (CTP1)"},"content":{"rendered":"<p><H3>1. Introduction<\/H3>\n<P>The Open Data Protocol Visualizer for Visual Studio&nbsp;CTP1&nbsp;(\u201cthe visualizer\u201d) is a extension that provides a read-only visualization of the types, properties, associations, and other objects in the <A href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/bb387122.aspx\">Entity Data Model (EDM)<\/A> returned from an <A href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/cc716656.aspx\">Open Data Protocol\u2019s metadata endpoint<\/A> (this document assumes basic familiarity with the EDM).<\/P>\n<P>For instructions on how to create a data service, <A href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/cc907912.aspx\">see here<\/A>.<\/P>\n<P>This blog post uses a slightly modified version of a model reverse-engineered from part of the <A href=\"https:\/\/www.microsoft.com\/downloads\/details.aspx?FamilyID=06616212-0356-46A0-8DA2-EEBC53A68034&amp;displaylang=en\">Northwind database<\/A>. For general purposes, the <A href=\"http:\/\/www.codeplex.com\/MSFTDBProdSamples\">AdventureWorks sample database<\/A>, or any other database you choose, will work as well.<\/P>\n<H3>2. Walkthrough<\/H3>\n<P>The modifications made to the Northwind model were done in order to demonstrate additional features of the visualizer. Specifically:<\/P>\n<P><STRONG>1.<\/STRONG> The address fields in various types in the model have been replaced by the usage of a <A href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/bb738466.aspx\">Complex Type<\/A> called \u201cAddress\u201d. <BR><STRONG>2.<\/STRONG> A subtype of Product called \u201cDiscontinuedProduct\u201d has been added. <BR>&nbsp;&nbsp;&nbsp; <STRONG>a.<\/STRONG> The \u201cDiscontinued\u201d property has been removed from Product. <BR>&nbsp;&nbsp;&nbsp; <STRONG>b.<\/STRONG> Product is mapped to the Products table with condition Discontinued=false <BR>&nbsp;&nbsp;&nbsp; <STRONG>c.<\/STRONG> DiscontinuedProduct is mapped to the Products table with condition Discontinued=true <BR><STRONG>3.<\/STRONG> Two <A href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/cc716710.aspx\">function imports<\/A> have been added to the model for the \u201cEmployee_Sales_by_Country\u201d and \u201cSales_by_Year\u201d stored procedures. <BR><STRONG>4.<\/STRONG> For each stored procedure, a complex type has been created to hold its results, and a method added to the data context to enable it.<\/P>\n<P>The XML for this model is available for download <A href=\"http:\/\/blogs.msdn.com\/astoriateam\/attachment\/9923781.ashx\"><STRONG>here<\/STRONG><\/A>.<\/P>\n<H4>2.1 Install<\/H4>\n<P>Launch the \u201cExtension Manager\u201d from the Visual Studio \u201cTools\u201d menu. The visualizer is available from the online gallery, and you can find it quickly by entering \u201cOpen Data Protocol\u201d into the search field:<\/P>\n<P><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/23\/2019\/02\/image_2.png\"><IMG title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/23\/2019\/02\/image_thumb.png\" width=\"632\" height=\"72\"><\/A> <B><\/B><\/P>\n<P>The visualizer is available for download from the Visual Studio Gallery here:<\/P>\n<P><A href=\"http:\/\/visualstudiogallery.msdn.microsoft.com\/en-us\/f4ac856a-796e-4d78-9a3d-0120d8137722\">http:\/\/visualstudiogallery.msdn.microsoft.com\/en-us\/f4ac856a-796e-4d78-9a3d-0120d8137722<\/A><\/P>\n<H4>2.2 Setup<\/H4>\n<P>To get up and running:<\/P>\n<P><STRONG>1.<\/STRONG> Create a solution containing a web application project and a console application.<\/P>\n<P><STRONG>2.<\/STRONG> Add a new, blank ADO.NET Entity Data Model to the web application.<\/P>\n<P><STRONG>3.<\/STRONG> Close the model.<\/P>\n<P><STRONG>4.<\/STRONG> Right-click the model file, select \u201cOpen With\u201d and in the list, select \u201cXML Editor\u201d.<\/P>\n<P><STRONG>5.<\/STRONG> Paste the contents of the <A href=\"http:\/\/blogs.msdn.com\/astoriateam\/attachment\/9923781.ashx\">Modified Northwind Model<\/A> into it.<\/P>\n<P><STRONG>6.<\/STRONG> Save and close the model file.<\/P>\n<P><STRONG>7.<\/STRONG> If you do not have it already set up, add the Northwind.MDF database to the web application\u2019s App_Data folder. <\/P>\n<P><STRONG>8.<\/STRONG> Double-click the model file to open it with the designer.<\/P>\n<P><STRONG>9.<\/STRONG> Right click on the designer surface and select \u201cUpdate Model from Database\u201d.<\/P>\n<P><STRONG>10.<\/STRONG> Select the connection to Northwind.MDF, which will be automatically created for you when the MDF file is added to App_Data. If you are using your own database, you may need to create a new connection to it.<\/P>\n<P><STRONG>11.<\/STRONG> Proceed through the update wizard, accepting all the defaults, adding no new objects. This process will set up the database connection for you in web.config. It should look like this:<\/P>\n<P class=\"MsoNormal\"><SPAN>&lt;<\/SPAN><SPAN>add<\/SPAN><SPAN> <\/SPAN><SPAN>name<\/SPAN><SPAN>=<\/SPAN><SPAN>&#8220;<SPAN>NORTHWNDEntities<\/SPAN>&#8220;<SPAN> <\/SPAN><SPAN>connectionString<\/SPAN><SPAN>=<\/SPAN>&#8220;<SPAN>metadata=res:\/\/*\/Model1.csdl|res:\/\/*\/Model1.ssdl|res:\/\/*\/Model1.msl;provider=System.Data.SqlClient;provider connection string=<\/SPAN><SPAN>&amp;quot;<\/SPAN><SPAN>Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\NORTHWND.MDF;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True<\/SPAN><SPAN>&amp;quot;<\/SPAN>&#8220;<SPAN> <\/SPAN><SPAN>providerName<\/SPAN><SPAN>=<\/SPAN>&#8220;<SPAN>System.Data.EntityClient<\/SPAN>&#8220;<SPAN> \/&gt; <\/P><\/SPAN><\/SPAN>\n<P><STRONG>12.<\/STRONG> Add a new WCF Data Service (in Beta2 this will show up as ADO.NET Data Service) and configure it as shown below. Note the additional web methods and the exposure of all entity sets and all service operations using the \u201c*\u201d string. This lack of security means that this is not a data service that you would want to expose publicly.<\/P>\n<P class=\"MsoNormal\"><SPAN>using<\/SPAN><SPAN> System; <BR><\/SPAN><SPAN>using<\/SPAN><SPAN> System.Collections.Generic; <BR><\/SPAN><SPAN>using<\/SPAN><SPAN> System.Data.Objects; <BR><\/SPAN><SPAN>using<\/SPAN><SPAN> System.Data.Services; <BR><\/SPAN><SPAN>using<\/SPAN><SPAN> System.Data.Services.Common; <BR><\/SPAN><SPAN>using<\/SPAN><SPAN> System.Linq; <BR><\/SPAN><SPAN>using<\/SPAN><SPAN> System.ServiceModel.Web; <BR><\/SPAN><SPAN>using<\/SPAN><SPAN> System.Web;<\/SPAN><SPAN> <\/P><\/SPAN>\n<P class=\"MsoNormal\"><SPAN>namespace<\/SPAN><SPAN> NorthwindServices <BR><\/SPAN><SPAN>{ <BR><\/SPAN><SPAN><SPAN>&nbsp;&nbsp;&nbsp; <\/SPAN><SPAN>public<\/SPAN> <SPAN>class<\/SPAN> <SPAN>NorthwindService<\/SPAN> : <SPAN>DataService<\/SPAN>&lt;<SPAN>NORTHWNDEntities<\/SPAN>&gt; <BR><\/SPAN><SPAN><SPAN>&nbsp;&nbsp;&nbsp; <\/SPAN>{ <BR><\/SPAN><SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><SPAN>\/\/ This method is called only once to initialize service-wide policies. <BR><\/SPAN><\/SPAN><SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><SPAN>public<\/SPAN> <SPAN>static<\/SPAN> <SPAN>void<\/SPAN> InitializeService(<SPAN>DataServiceConfiguration<\/SPAN> config) <BR><\/SPAN><SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>{ <BR><\/SPAN><SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>config.SetEntitySetAccessRule(<SPAN>&#8220;*&#8221;<\/SPAN>, <SPAN>EntitySetRights<\/SPAN>.AllRead); <BR><\/SPAN><SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>config.SetServiceOperationAccessRule(<SPAN>&#8220;*&#8221;<\/SPAN>, <SPAN>ServiceOperationRights<\/SPAN>.All); <BR><\/SPAN><SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>config.DataServiceBehavior.MaxProtocolVersion = <SPAN>DataServiceProtocolVersion<\/SPAN>.V2; <BR><\/SPAN><SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>} <\/P><\/SPAN>\n<P class=\"MsoNormal\"><SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>[<SPAN>WebGet<\/SPAN>] <BR><\/SPAN><SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><SPAN>public<\/SPAN> <SPAN>ObjectResult<\/SPAN>&lt;<SPAN>Employee_Sales_by_Country_Result<\/SPAN>&gt; GetEmployeeSalesByCountry(<SPAN>DateTime<\/SPAN> start, <SPAN>DateTime<\/SPAN> end) <BR><\/SPAN><SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>{ <BR><\/SPAN><SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><SPAN>NORTHWNDEntities<\/SPAN> entities = <SPAN>new<\/SPAN> <SPAN>NORTHWNDEntities<\/SPAN>(); <BR><\/SPAN><SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><SPAN>return<\/SPAN> entities.Employee_Sales_by_Country(start, end); <BR><\/SPAN><SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>} <\/P><\/SPAN>\n<P class=\"MsoNormal\"><SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>[<SPAN>WebGet<\/SPAN>] <BR><\/SPAN><SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><SPAN>public<\/SPAN> <SPAN>ObjectResult<\/SPAN>&lt;<SPAN>Sales_by_Year_Result<\/SPAN>&gt; GetSalesByYear(<SPAN>DateTime<\/SPAN> start, <SPAN>DateTime<\/SPAN> end) <BR><\/SPAN><SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>{ <BR><\/SPAN><SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><SPAN>NORTHWNDEntities<\/SPAN> entities = <SPAN>new<\/SPAN> <SPAN>NORTHWNDEntities<\/SPAN>(); <BR><\/SPAN><SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN><SPAN>return<\/SPAN> entities.Sales_by_Year(start, end); <BR><\/SPAN><SPAN><SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/SPAN>} <BR><\/SPAN><SPAN><SPAN>&nbsp;&nbsp;&nbsp; <\/SPAN>} <BR><\/SPAN><SPAN>} <\/P><\/SPAN>\n<P><STRONG>13.<\/STRONG> Right click on the service and select \u201cView in Browser\u201d.<\/P>\n<P><STRONG>14.<\/STRONG> Copy the URL shown in the browser, it should look like this: <I>http:\/\/localhost:11968\/NorthwindService.svc<\/I><\/P>\n<P><STRONG>15.<\/STRONG> In the console application project add a new service reference.<\/P>\n<P><STRONG>16.<\/STRONG> Paste the URL into the \u201cAddress\u201d field. Change the \u201cNamespace\u201d to \u201cNorthwindServiceReference\u201d, as shown below.<\/P>\n<P><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/23\/2019\/02\/image_4.png\"><IMG title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/23\/2019\/02\/image_thumb_1.png\" width=\"543\" height=\"444\"><\/A> <\/P>\n<P><STRONG>17.<\/STRONG> Click OK.<\/P>\n<H4>2.3 Visualizing the Model<\/H4>\n<P>The visualizer consists of two main components: The <B>diagram<\/B>, which can show all, or part of the model, as a two-dimensional graph, and the <B>model browser<\/B>, which is a Visual Studio tool window that presents the complete contents of the model as a hierarchical tree. We begin by examining the structure and capabilities of the diagram.<\/P>\n<H4>2.4 Launching the Visualizer<\/H4>\n<P>Once installed, the visualizer is launched by right-clicking any Service Reference that supports the Open Data Protocol<A title=\"_GoBack\" name=\"_GoBack\"><\/A> and selecting \u201cView in Diagram\u201d:<\/P>\n<P><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/23\/2019\/02\/image_6.png\"><IMG title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/23\/2019\/02\/image_thumb_2.png\" width=\"365\" height=\"410\"><\/A> <\/P>\n<P>This will bring up the overview screen in a new document window. This screen provides a number of quick links for rapidly creating a diagram:<\/P>\n<P><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/23\/2019\/02\/image_8.png\"><IMG title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/23\/2019\/02\/image_thumb_3.png\" width=\"631\" height=\"253\"><\/A> <\/P>\n<TABLE class=\"MsoTableMediumList2Accent1\" border=\"1\" cellSpacing=\"0\" cellPadding=\"0\">\n<TBODY>\n<TR>\n<TD vAlign=\"top\" width=\"199\">\n<P class=\"MsoNormal\"><SPAN><STRONG>Link<\/STRONG> \n<P>&nbsp;<\/P><\/SPAN><\/TD>\n<TD vAlign=\"top\" width=\"439\">\n<P class=\"MsoNormal\"><SPAN><STRONG>Behavior <\/STRONG>\n<P>&nbsp;<\/P><\/SPAN><\/TD><\/TR>\n<TR>\n<TD vAlign=\"top\" width=\"199\">\n<P class=\"MsoNormal\"><SPAN>Data services model browser \n<P>&nbsp;<\/P><\/SPAN><\/TD>\n<TD vAlign=\"top\" width=\"439\">\n<P class=\"MsoNormal\"><SPAN>Will make the model browser tool window visible. \n<P>&nbsp;<\/P><\/SPAN><\/TD><\/TR>\n<TR>\n<TD vAlign=\"top\" width=\"199\">\n<P class=\"MsoNormal\"><SPAN>Add all namespaces \n<P>&nbsp;<\/P><\/SPAN><\/TD>\n<TD vAlign=\"top\" width=\"439\">\n<P class=\"MsoNormal\"><SPAN>Adds all entity types and complex types, and by extension, all associations, to the model. \n<P>&nbsp;<\/P><\/SPAN><\/TD><\/TR>\n<TR>\n<TD vAlign=\"top\" width=\"199\">\n<P class=\"MsoNormal\"><SPAN>Add all entity types \n<P>&nbsp;<\/P><\/SPAN><\/TD>\n<TD vAlign=\"top\" width=\"439\">\n<P class=\"MsoNormal\"><SPAN>Will add all entity types, and any associations between them, to the diagram. \n<P>&nbsp;<\/P><\/SPAN><\/TD><\/TR>\n<TR>\n<TD vAlign=\"top\" width=\"199\">\n<P class=\"MsoNormal\"><SPAN>Add all hubs \n<P>&nbsp;<\/P><\/SPAN><\/TD>\n<TD vAlign=\"top\" width=\"439\">\n<P class=\"MsoNormal\"><SPAN>Will add the entity types whose number of associations is in the top 25% in the model to the diagram. This is intended to provide a useful starting point in making sense of models by adding only the most highly connected types. \n<P>&nbsp;<\/P><\/SPAN><\/TD><\/TR>\n<TR>\n<TD vAlign=\"top\" width=\"199\">\n<P class=\"MsoNormal\"><SPAN>Add all complex types \n<P>&nbsp;<\/P><\/SPAN><\/TD>\n<TD vAlign=\"top\" width=\"439\">\n<P class=\"MsoNormal\"><SPAN>Will add all complex types to the diagram. \n<P>&nbsp;<\/P><\/SPAN><\/TD><\/TR>\n<TR>\n<TD vAlign=\"top\" width=\"199\">\n<P class=\"MsoNormal\"><SPAN>Add all associations \n<P>&nbsp;<\/P><\/SPAN><\/TD>\n<TD vAlign=\"top\" width=\"439\">\n<P class=\"MsoNormal\"><SPAN>Adds all associations and their entity types to the diagram. \n<P>&nbsp;<\/P><\/SPAN><\/TD><\/TR><\/TBODY><\/TABLE>\n<H4>2.5 Working with a Diagram<\/H4>\n<P><STRONG>1.<\/STRONG> Selecting \u201cadd all hubs\u201d will result in the following diagram:<\/P>\n<P><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/23\/2019\/02\/image_10.png\"><IMG title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/23\/2019\/02\/image_thumb_4.png\" width=\"166\" height=\"244\"><\/A> <\/P>\n<P><STRONG>2.<\/STRONG> Deselect any selected objects (by clicking anywhere on the canvas) and right-click the \u201cEmployee\u201d shape to bring up this context menu:<\/P>\n<P><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/23\/2019\/02\/image_12.png\"><IMG title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/23\/2019\/02\/image_thumb_5.png\" width=\"303\" height=\"295\"><\/A> <\/P>\n<P>Select \u201cAdd Related Entities\u201d.<\/P>\n<P><STRONG>3.<\/STRONG> Click on Employees again and select \u201cAdd Related Complex Types\u201d.<\/P>\n<P><STRONG>4.<\/STRONG> Switch to the left-to-right view (Alt+Right Arrow.) <BR>The diagram now shows all entity types related to Employee as well any complex types used by it:<\/P>\n<P><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/23\/2019\/02\/image_14.png\"><IMG title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/23\/2019\/02\/image_thumb_6.png\" width=\"206\" height=\"244\"><\/A> <\/P>\n<P><STRONG>5.<\/STRONG> Multi-select Order and Product and select \u201cAdd Related Entities\u201d. At this point, most of the model will be visible in the diagram. Note that all newly added objects are now selected. This is intended to accomplish two goals: Allow easy iterative addition of related types to a model, and also make it easy to distinguish newly added types from previously added types.<\/P>\n<H5>2.5.1 Visualizing Relationships<\/H5>\n<P><STRONG>1.<\/STRONG> We can further simplify the rendering of the model by changing the way shapes are rendered. Right click anywhere in the diagram and unmark the \u201cExpanded Shapes\u201d checkbox command. This will hide all properties, making it easier to focus on relationships between types:<\/P>\n<P><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/23\/2019\/02\/image_16.png\"><IMG title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/23\/2019\/02\/image_thumb_7.png\" width=\"244\" height=\"225\"><\/A> <\/P>\n<P><STRONG>2.<\/STRONG> Selecting an association will highlight the navigation properties that navigate it. For example, after expanding the shapes to show properties again, we select the association between Employee and Territory and see that navigation properties Employee.Territories and Territory. Employees, which traverse this association, become highlighted:<\/P>\n<P><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/23\/2019\/02\/image_18.png\"><IMG title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/23\/2019\/02\/image_thumb_8.png\" width=\"244\" height=\"182\"><\/A> <\/P>\n<H3>3 Using the Model Browser<\/H3>\n<P>The Model Browser provides an unfiltered view of the model. Its root contains a schema node for each namespace in a model, and a node the EntityContainer.<\/P>\n<P><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/23\/2019\/02\/image_20.png\"><IMG title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/23\/2019\/02\/image_thumb_9.png\" width=\"292\" height=\"278\"><\/A> <\/P>\n<P>To show the model browser, go to the \u201cView\u201d menu item in Visual Studio and select \u201cData Services Model Browser\u201d. You can also right-click in the visualizer and select \u201cShow In Model Browser\u201d, which will bring the model browser into view and select the object under the mouse.<\/P>\n<H4>3.1 Schema Nodes<\/H4>\n<P>Schema nodes show the entity types, complex types, and associations in a schema.<\/P>\n<P>To add a type to the diagram, expand the Entity Types node and drag and drop it onto the diagram. You can also right-click the type and click on \u201cSelect in Diagram,\u201d or double-click it. This will add the type to the diagram if it is not present, select it, and scroll the diagram to make the type shape visible.<\/P>\n<P>These same actions also work for complex types and associations. In the latter case, adding an association to the diagram will add both of the association\u2019s ends\u2019 entity types as well.<\/P>\n<BLOCKQUOTE>\n<P><STRONG>1.<\/STRONG> Clear the diagram by selecting all objects using Ctrl+A and removing them using the Delete key. <\/P>\n<P><STRONG>2.<\/STRONG> Double-click the \u201cEmployee\u201d entity type.<\/P>\n<P><STRONG>3.<\/STRONG> Drag and drop \u201cOrder\u201d onto the diagram. Note that the location of the drop does not matter, as the layout in the diagram is always automatic.<\/P>\n<P><STRONG>4.<\/STRONG> Right-click the \u201cAddress\u201d complex type and click on \u201cSelect In Diagram\u201d. Finally, double-click on the \u201cFK_Orders_Shippers\u201d association. With a left to right layout, your diagram should look like this:<\/P><\/BLOCKQUOTE>\n<P><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/23\/2019\/02\/image_22.png\"><IMG title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/23\/2019\/02\/image_thumb_10.png\" width=\"244\" height=\"206\"><\/A> <\/P>\n<P>Note that the addition of the foreign key added the \u201cShipper\u201d type and selected both it and \u201cOrder\u201d, which make up both sides of the association, and also selected the two navigation properties, \u201cOrder.Shipper\u201d and \u201cShipper.Orders\u201d, which traverse this association.<\/P>\n<H5>3.1.1 Properties<\/H5>\n<P>While the diagram surface does not yet allow selection of properties, the model browser does. Expand the Entity Types node, and within it, expand the \u201cCategory\u201d type. Right-click \u201cCategoryID\u201d and select \u201cView Generated Code\u201d to see the code generated for this property. Close the code, right-click \u201cCategoryID\u201d and select \u201cProperties\u201d to view the property sheet for it.<\/P>\n<H4>3.2 EntityContainer Nodes<\/H4>\n<P>Expand the Entity Sets node and right-click on \u201cCategories\u201d. Selecting \u201cView Generated Code\u201d will take you to the dataServiceQuery&lt;Category&gt; that was generated from this entity set. Next, select \u201cGo to Entity Type\u201d, which should select the \u201cCategory\u201d type. Finally, select \u201cView in Browser\u201d which will bring up the browser and point it at http:\/\/[your server]\/NorthwindDataService.svc\/Categories. Note that selecting \u201cView In Browser\u201d on entity types, for example on \u201cCategory\u201d, will bring up the same URL, as all such queries must reference a type\u2019s entity set.<\/P>\n<H4>3.3 The Search Bar<\/H4>\n<P>At the top of the model browser is the search bar. Collapse down the model browser to its root node and click the search box labeled \u201cType here to search\u201d. In the search box, type \u201ccat\u201d and hit enter or click on the icon. The search will cover all objects in the entity container and schema nodes, down to individual properties or association ends. The model browser will show the search results bar, expand all nodes with matches and highlight those matches, and provide tick marks on the scroll bar:<\/P>\n<P><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/23\/2019\/02\/image_24.png\"><IMG title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/23\/2019\/02\/image_thumb_11.png\" width=\"292\" height=\"521\"><\/A>&nbsp;<\/P>\n<P>Click the up\/down arrows to the right of the \u201cItems matching\u2026\u201d message to move forward and back through results. You can also click on tick marks, which will scroll the corresponding match into view and select it. When you are done, click the button at the right of the search results bar to clear out the search. You can perform this search again any time by selecting the search from the search box\u2019s drop-down search history:<\/P>\n<H3>4. Conclusion<\/H3>\n<P>This walkthrough does not touch on some additional capabilities of the visualization tool, such as the ability to display data services-specific metadata. We will cover these capabilities, and others, when we release the next update to this tool.<\/P>\n<P>We hope you will find this tool useful and look forward to your feedback.<\/P>\n<P><STRONG>Noam Ben-Ami &amp; Fabian Winternitz<BR><\/STRONG>Microsoft<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. Introduction The Open Data Protocol Visualizer for Visual Studio&nbsp;CTP1&nbsp;(\u201cthe visualizer\u201d) is a extension that provides a read-only visualization of the types, properties, associations, and other objects in the Entity Data Model (EDM) returned from an Open Data Protocol\u2019s metadata endpoint (this document assumes basic familiarity with the EDM). For instructions on how to create [&hellip;]<\/p>\n","protected":false},"author":512,"featured_media":3253,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[6,24,48],"class_list":["post-1553","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-odata","tag-ado-net-data-services","tag-data-services-futures","tag-odata"],"acf":[],"blog_post_summary":"<p>1. Introduction The Open Data Protocol Visualizer for Visual Studio&nbsp;CTP1&nbsp;(\u201cthe visualizer\u201d) is a extension that provides a read-only visualization of the types, properties, associations, and other objects in the Entity Data Model (EDM) returned from an Open Data Protocol\u2019s metadata endpoint (this document assumes basic familiarity with the EDM). For instructions on how to create [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/posts\/1553","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/users\/512"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/comments?post=1553"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/posts\/1553\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/media\/3253"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/media?parent=1553"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/categories?post=1553"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/tags?post=1553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}