ODataConnectedService icon indicating copy to clipboard operation
ODataConnectedService copied to clipboard

EntitySet attribute is missing.

Open vladascibulskis opened this issue 3 years ago • 1 comments

Describe the bug

Microsoft.OData.Client.EntitySet attribute is missing.

Version of the Project affected

ODataConnectedService v0.13.0 VisualStudio Version v16.11.5 Microsoft.Odata.Client v7.9.4

To Reproduce

Extract metadata.xml file. Use it to generate OData proxy. $metadata1.zip

Expected behavior

AcceptanceLot class should have following attribute: [global::Microsoft.OData.Client.EntitySet("AcceptanceLots")]

Actual behavior

The attribute is missing.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

The issue is caused by the fact that EntityType and EntitySet are defined in different Namespaces in metadata file. T4 template processes each namespace sequentially and builds dictionary that tracks all entity sets as it goes. Because entity sets are defined in last namespace this means that all EntityTypes processed in previous namespaces are missing EntitySet attribute.

I had implemented a workaround solution for my own use in a following way (*.ttinclude file): ReproProxy.zip

It simply extracted entity set dictionary population step into separate function and execute it before processing EntityTypes.

vladascibulskis avatar Nov 11 '21 08:11 vladascibulskis

Hi @vladascibulskis the current implementation was not designed to support services that span multiple namespaces. Would you consider contributing a PR with the fix that you have proposed?

habbes avatar Jan 25 '22 18:01 habbes