OData / lab

This repository is for exploring new ideas and developing early prototypes of various OData stacks.
Other
48 stars 59 forks source link

"Adding OData Connected Service to the project failed: Unable to cast object of type 'Microsoft.OData.Edm.Library.AmbiguousTypeBinding' to type 'Microsoft.OData.Edm.IEdmCollectionType'." #75

Open BrainSlugs83 opened 6 years ago

BrainSlugs83 commented 6 years ago

Using the Add-in with VS2017 -- trying to add a connected OData service for the beta version of Microsoft Graph (https://graph.microsoft.com/beta/$metadata), and I end up with this:

Adding Nuget Packages
Generating Client Proxy ...
Error:Adding OData Connected Service to the project failed: Unable to cast object of type 'Microsoft.OData.Edm.Library.AmbiguousTypeBinding' to type 'Microsoft.OData.Edm.IEdmCollectionType'.

Trying to do it with T4 templates gives the same error.

mattskel commented 6 years ago

I am experiencing exactly the same problem. Has anyone found a solution for this?

BrainSlugs83 commented 6 years ago

Any news? -- This is kind of a blocking bug that is preventing folks from using the tool.

rizworks commented 6 years ago

Any updates on this? it is affecting us to generate proxy for consuming D365 for operation Odata endpoints.

qazsen commented 6 years ago

I also have same problem.

dcs-kartik commented 6 years ago

Is there any solution for this error.?

As one of the way to create a file and reference to that file doesn't work. there is reference among the entities so we cannot identify what to remove and what to keep.

zameer218 commented 6 years ago

Hi All,

Even I`m getting the same error message. Please provide a solution for this.

Regards,

AlanWong-MS commented 6 years ago

There is a code delta between the Connected Services extension and the actively developed Client Code Gen extension; the state of the Connected Services extension is under review. A workaround for now is to use the Client Code Gen extension to help generate the proxy code against https://graph.microsoft.com/beta/$metadata.

One can accomplish this by installing the extension from above and then

  1. In your project that needs reference to the MSGraph entities, right-click on the project in Solution Explorer and go to Add->New Item.
  2. There should be an option for OData Client. Name your .tt file as appropriate. image
  3. A .tt file should be added to your project. Double-click on it in the Solution Explorer to open it. Add "https://graph.microsoft.com/beta/$metadata" into the MetadataDocumentUri field (it should read public const string MetadataDocumentUri = "https://graph.microsoft.com/beta/$metadata";). Then hit Ctrl+S to save the file and your proxy should be generated. Sample below: image

Also attached my generated file. ProxyForMSGraphBeta.zip

unchase commented 5 years ago

Now it works great in Unchase OData ConnectedService v.1.1.2. Check it.