{"id":3935,"date":"2020-03-28T08:05:23","date_gmt":"2020-03-28T15:05:23","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/odata\/?p=3935"},"modified":"2020-03-28T08:05:23","modified_gmt":"2020-03-28T15:05:23","slug":"odata-connected-service-0-7-1-release","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/odata\/odata-connected-service-0-7-1-release\/","title":{"rendered":"OData Connected Service 0.7.1 Release"},"content":{"rendered":"<p>We are pleased to announce a new release of OData Connected Service, version 0.7.1. This version adds the following important features and bug fixes:<\/p>\n<ol>\n<li>VB.NET support<\/li>\n<li>Option to include or exclude operation imports from generated code<\/li>\n<li>Ability to access the metadata endpoint behind a proxy<\/li>\n<li>Bug fixes and other improvements<\/li>\n<\/ol>\n<p>You can get the extension from the <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=laylaliu.ODataConnectedService\">Visual Studio Marketplace<\/a>.<\/p>\n<h2>1. VB.NET Support<\/h2>\n<p>You can now use OData Connected Service extension to generate OData client code for Visual Basic projects. The features supported in C# are also supported in VB.NET projects.<\/p>\n<p>Let\u2019s create a simple VB.NET project to demonstrate how it works. Open Visual Studio and create a VB .NET Core Console App.<\/p>\n<p>When the new project is ready, right-click the project node from the Solution Explorer and then choose <strong>Add<\/strong> &gt; <strong>Connected Service<\/strong> in the context menu that appears<\/p>\n<p><img decoding=\"async\" width=\"629\" height=\"198\" class=\"wp-image-3937\" src=\"https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/a-screenshot-of-a-cell-phone-description-automati.png\" alt=\"A screenshot of a cell phone Description automatically generated\" srcset=\"https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/a-screenshot-of-a-cell-phone-description-automati.png 629w, https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/a-screenshot-of-a-cell-phone-description-automati-300x94.png 300w\" sizes=\"(max-width: 629px) 100vw, 629px\" \/><\/p>\n<p>In the Connected Services tab, select <strong>OData Connected Service<\/strong>.<\/p>\n<p><img decoding=\"async\" width=\"552\" height=\"288\" class=\"wp-image-3938\" src=\"https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/a-screenshot-of-a-cell-phone-description-automati-1.png\" alt=\"A screenshot of a cell phone Description automatically generated\" srcset=\"https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/a-screenshot-of-a-cell-phone-description-automati-1.png 552w, https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/a-screenshot-of-a-cell-phone-description-automati-1-300x157.png 300w\" sizes=\"(max-width: 552px) 100vw, 552px\" \/><\/p>\n<p>This loads the OData Connected Service configuration wizard. For this demo, we\u2019ll keep things simple and stick to the default settings. For the <strong>service address<\/strong>, use the sample Trip Pin service endpoint: https:\/\/services.odata.org\/v4\/TripPinService<\/p>\n<p><img decoding=\"async\" width=\"802\" height=\"551\" class=\"wp-image-3939\" src=\"https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/word-image.png\" srcset=\"https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/word-image.png 802w, https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/word-image-300x206.png 300w, https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/word-image-768x528.png 768w\" sizes=\"(max-width: 802px) 100vw, 802px\" \/><\/p>\n<p>Click <strong>Finish<\/strong> to start the client code generation process. After the process is complete, a <strong>Connected Services<\/strong> node is added to your project together with a child node named \u201c<strong>OData Service<\/strong>\u201d. Inside the folder you should see the generated <strong>Reference.vb<\/strong> file.<\/p>\n<p><img decoding=\"async\" width=\"264\" height=\"125\" class=\"wp-image-3940\" src=\"https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/a-screenshot-of-a-cell-phone-description-automati-2.png\" alt=\"A screenshot of a cell phone Description automatically generated\" \/><\/p>\n<p>We\u2019ll use the generated code to fetch a list of people from the service and display their names in the console.<\/p>\n<p>Open the Program.vb file and replace its content with the following code:<\/p>\n<pre title=\"Sample OData VB Client\" class=\"lang:vbnet decode:true \">Imports System\r\n' this is the namespace that contains the generated code, based on the namespace defined in the service metadata\r\nImports OcsVbDemo.Microsoft.OData.SampleService.Models.TripPin\r\n \r\nModule Program\r\nSub Main(args As String())\r\nDisplayPeople().Wait()\r\nEnd Sub\r\n \r\n''' &lt;summary&gt;\r\n''' Fetches and displayes a list of people from the OData service\r\n''' &lt;\/summary&gt;\r\n''' &lt;returns&gt;&lt;\/returns&gt;\r\nAsync Function DisplayPeople() As Task\r\nDim container = New DefaultContainer(New Uri(\"https:\/\/services.odata.org\/v4\/TripPinService\"))\r\nDim people = Await container.People.ExecuteAsync()\r\n \r\nFor Each person In people\r\nConsole.WriteLine(person.FirstName)\r\nNext\r\nEnd Function\r\nEnd Module<\/pre>\n<p>&nbsp;<\/p>\n<p>The <code>DefaultContainer<\/code> is a generated class that inherits from <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.odata.client.dataservicecontext?view=odata-client-7.0\">DataServiceContext<\/a> and gives us access to the resources exposed by the service. We create a Container instance using the URL of the service root. The container has a generated People property which we\u2019ll use to execute a query against the People entity set on the OData service and then display the results.<\/p>\n<p>Finally, let\u2019s run the app. You should see a list of names displayed on the console:<\/p>\n<p><img decoding=\"async\" width=\"977\" height=\"290\" class=\"wp-image-3941\" src=\"https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/word-image-1.png\" srcset=\"https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/word-image-1.png 977w, https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/word-image-1-300x89.png 300w, https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/word-image-1-768x228.png 768w\" sizes=\"(max-width: 977px) 100vw, 977px\" \/><\/p>\n<h2>2. Include\/Exclude operation imports<\/h2>\n<p>This feature allows you to select the operations you want included in the generated code and exclude the ones you don\u2019t want. This gives you more control and helps keep the generated code lean. There is more work being done in this area, and in an upcoming release, you will also have the option to exclude entity types that you don\u2019t need.<\/p>\n<p>This feature is available on the new <strong>Function\/Action Imports<\/strong> page of the wizard.<\/p>\n<p><img decoding=\"async\" width=\"799\" height=\"551\" class=\"wp-image-3942\" src=\"https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/a-screenshot-of-a-cell-phone-description-automati-3.png\" alt=\"A screenshot of a cell phone Description automatically generated\" srcset=\"https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/a-screenshot-of-a-cell-phone-description-automati-3.png 799w, https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/a-screenshot-of-a-cell-phone-description-automati-3-300x207.png 300w, https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/a-screenshot-of-a-cell-phone-description-automati-3-768x530.png 768w\" sizes=\"(max-width: 799px) 100vw, 799px\" \/><\/p>\n<p>In the example above, GetNearestAirport and ResetDataSource will be generated, but GetPersonWithMostFriends will not.<\/p>\n<p>Here are some important things to keep in mind regarding this feature:<\/p>\n<ul>\n<li>It only covers operation imports (action and function imports), which are exposed directly on the entity container, it does not affect functions and actions accessible through entity types.<\/li>\n<li>When an operation import is excluded, all its overloads get excluded<\/li>\n<li>It is not supported for OData v3 services or lower.<\/li>\n<\/ul>\n<h2>3. Fetching service metadata behind a web proxy<\/h2>\n<p>Previously, when you used the connected service on a network that has a web proxy, the call to fetch service metadata would fail. To address this issue, we have provided a means for you to specify the web proxy configuration and credentials needed to access the network in such situations. These settings are not saved in the generated client, they are only used to fetch the metadata document during code generation. They are also not persisted or cached by default, meaning you would have to enter them each time you add or update a connected service.<\/p>\n<p>You can specify the web proxy settings on the first page of the configuration wizard:<\/p>\n<p><img decoding=\"async\" width=\"803\" height=\"554\" class=\"wp-image-3943\" src=\"https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/a-screenshot-of-a-cell-phone-description-automati-4.png\" alt=\"A screenshot of a cell phone Description automatically generated\" srcset=\"https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/a-screenshot-of-a-cell-phone-description-automati-4.png 803w, https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/a-screenshot-of-a-cell-phone-description-automati-4-300x207.png 300w, https:\/\/devblogs.microsoft.com\/odata\/wp-content\/uploads\/sites\/23\/2020\/03\/a-screenshot-of-a-cell-phone-description-automati-4-768x530.png 768w\" sizes=\"(max-width: 803px) 100vw, 803px\" \/><\/p>\n<h2>4. Bug fixes and minor improvements<\/h2>\n<ul>\n<li>A bug was reported in the previous release that caused the connected service to fail if you provided a local file as the service address. This bug has been fixed<\/li>\n<li>We added a Browser button to make it easier to select local files<\/li>\n<\/ul>\n<p>Stay tuned for the next release.<\/p>\n<h2>Special thanks to the following contributors:<\/h2>\n<ul>\n<li>Chebotov Nickolay &#8211; <a href=\"https:\/\/github.com\/OData\/ODataConnectedService\/pull\/38\">VB support feature<\/a>.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>We are pleased to announce a new release of OData Connected Service, version 0.7.1. This version adds the following important features and bug fixes: VB.NET support Option to include or exclude operation imports from generated code Ability to access the metadata endpoint behind a proxy Bug fixes and other improvements You can get the extension [&hellip;]<\/p>\n","protected":false},"author":20326,"featured_media":3253,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3935","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-odata"],"acf":[],"blog_post_summary":"<p>We are pleased to announce a new release of OData Connected Service, version 0.7.1. This version adds the following important features and bug fixes: VB.NET support Option to include or exclude operation imports from generated code Ability to access the metadata endpoint behind a proxy Bug fixes and other improvements You can get the extension [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/posts\/3935","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\/20326"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/comments?post=3935"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/posts\/3935\/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=3935"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/categories?post=3935"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/odata\/wp-json\/wp\/v2\/tags?post=3935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}