OData Connected Service 0.7.1 Release

Clément Habinshuti

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:

  1. VB.NET support
  2. Option to include or exclude operation imports from generated code
  3. Ability to access the metadata endpoint behind a proxy
  4. Bug fixes and other improvements

You can get the extension from the Visual Studio Marketplace.

1. VB.NET Support

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.

Let’s create a simple VB.NET project to demonstrate how it works. Open Visual Studio and create a VB .NET Core Console App.

When the new project is ready, right-click the project node from the Solution Explorer and then choose Add > Connected Service in the context menu that appears

A screenshot of a cell phone Description automatically generated

In the Connected Services tab, select OData Connected Service.

A screenshot of a cell phone Description automatically generated

This loads the OData Connected Service configuration wizard. For this demo, we’ll keep things simple and stick to the default settings. For the service address, use the sample Trip Pin service endpoint: https://services.odata.org/v4/TripPinService

Click Finish to start the client code generation process. After the process is complete, a Connected Services node is added to your project together with a child node named “OData Service”. Inside the folder you should see the generated Reference.vb file.

A screenshot of a cell phone Description automatically generated

We’ll use the generated code to fetch a list of people from the service and display their names in the console.

Open the Program.vb file and replace its content with the following code:

Imports System
' this is the namespace that contains the generated code, based on the namespace defined in the service metadata
Imports OcsVbDemo.Microsoft.OData.SampleService.Models.TripPin
Module Program
Sub Main(args As String())
End Sub
''' <summary>
''' Fetches and displayes a list of people from the OData service
''' </summary>
''' <returns></returns>
Async Function DisplayPeople() As Task
Dim container = New DefaultContainer(New Uri("https://services.odata.org/v4/TripPinService"))
Dim people = Await container.People.ExecuteAsync()
For Each person In people
End Function
End Module


The DefaultContainer is a generated class that inherits from DataServiceContext 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’ll use to execute a query against the People entity set on the OData service and then display the results.

Finally, let’s run the app. You should see a list of names displayed on the console:

2. Include/Exclude operation imports

This feature allows you to select the operations you want included in the generated code and exclude the ones you don’t 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’t need.

This feature is available on the new Function/Action Imports page of the wizard.

A screenshot of a cell phone Description automatically generated

In the example above, GetNearestAirport and ResetDataSource will be generated, but GetPersonWithMostFriends will not.

Here are some important things to keep in mind regarding this feature:

  • 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.
  • When an operation import is excluded, all its overloads get excluded
  • It is not supported for OData v3 services or lower.

3. Fetching service metadata behind a web proxy

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.

You can specify the web proxy settings on the first page of the configuration wizard:

A screenshot of a cell phone Description automatically generated

4. Bug fixes and minor improvements

  • 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
  • We added a Browser button to make it easier to select local files

Stay tuned for the next release.

Special thanks to the following contributors:


Discussion is closed. Login to edit/delete existing comments.

  • Thomas Tomiczek 0

    This is crazy – in a positive sense. Are you guys going tp keep up this speed and start fixing what I remember to be the main reason to use simple.odata – missing features? Because it looks like you actually are getting serious with this client and I LOVE that part. Gratulations. Keep up that immense speed. Push updates as often as possible. This is what those of us using odata need.

    • chris dunn 0

      Hey, as someone interested in using odata for the first time I’d be interested to know what someone with obvious experience considers to be ‘missing features’ to help me understand the landscape, especially with graphql becoming quite popular. Thanks!

Feedback usabilla icon