OData Connected Service 0.6.0 has been released and is available in the Visual Studio Marketplace. The new version adds the following features:
- Custom Http headers.
- Generation of multiple files.
- Writing metadata to a file.
Custom Http Headers
This feature allows you to add headers that will be sent with the request that fetches the metadata used in generating proxy files. This is actually important when using protected metadata to generate proxy files. To access the metadata endpoint, you may be required to pass authorization headers as shown below. These values are not stored within the OData Connected Service or in your computer and you are required to provide them anytime you update the OData Connected Service.
HeaderKey1: HeaderValue1 HeaderKey2: HeaderValue2 HeaderKey3: HeaderValue3
Ensure that each header is on a separate line.
To use this feature, follow the following simple steps:
- Right click on the project you are working on from the solution explorer.
- Select Add->Connected Service from the context menu.
- From the Connected Service Window that opens, select the Microsoft OData Connected Service.
- On the wizard window, you will see a provision to input your Custom Headers. Input your headers using the above structure.
Generation of Multiple Files
This feature allows OData connected service to generate multiple files. Currently, OData Connected Service generates only one file. The size of this file varies depending on the size of your service’s metadata. If you have a huge metadata, then the generated file will be very huge and may affect the performance of your application. This feature works by generating a file for each entity type and enum type in your service’s metadata file.
If you have the OData Connected Service extension installed,
- Right click on the project you are working on from the solution explorer.
- Select Add->Connected Service from the context menu.
- From the Connected Service Window that opens, select the Microsoft OData Connected Service.
- On the wizard window, configure your service endpoint by providing the service name and the OData URL endpoint then click Next.
- On the Next page, click on the “AdvancedSettings” link.
Check the checkbox beside the “Generate multiple files” configuration on this page then click finish.
The generated files appear like below:
Writing metadata to a file
Currently, OData Connected Service writes an endpoint’s metadata to a string in the generated file. This makes the generated file unnecessarily huge and difficult to handle in cases where the metadata is huge. With this feature, an endpoint’s metadata will be written to a file and loaded when the DataServiceContext is initialized. This file is located within the connected service project folder and is called Csdl.xml.
Update
There are more features and fixes coming to OData Connected Service soon, so stay tuned for upcoming releases.
0 comments