Skip to main content

Posts

Showing posts with the label Connected Services

Generating Client Code from OData Metadata

Sometimes when we need to call APIs, we are just given the information about the entities in the form of OData metadata . Now when we are not aware about possible methods and their parameters which are exposed for use, it becomes very cumbersome and time consuming to call even a single method. Till some extent, we can still manage our life for Get methods as they are easy to guess using entity names, but when it comes to PUT/POST/PATCH , things are not straight forward. And here comes the need to generate classes with given metadata. Let’s have a look, on how we can generate these client-side proxy classes. Install the required Visual Studio Extension I’m using Visual Studio 2019 but the equivalent features are available in other versions too. Navigate to Manage Extensions dialog and search for OData Connected Service as shown below and install it. Using this tool, one can easily generate classes for all the entities and complex types which are menti