Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OData v4 Client Code Generator should consider entity set names with the same names as the container base properties #1146

Open
REscobar opened this issue Apr 9, 2018 · 0 comments
Labels
client only related to OData.Client P4

Comments

@REscobar
Copy link

REscobar commented Apr 9, 2018

I'm currently testing a service we are developing, was using linqpad and an extension that allows OData v4 client generation wich in turn uses the template and code in this repository.

The service in question has an entity set named "Format" and the proxy generation fails because the T4 template generates the entity set as a property on the proxy container, but the base class already defines a property named "Format", this results in a warning about hiding a field but also an error because it is modified in the constructor of the proxy container.

Assemblies affected

Client code generator from VS Marketplace 7.4.3 (beta)

Reproduce steps

Run the T4 template with this metadata document

 <?xml version="1.0" encoding="utf-8"?><edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"><edmx:DataServices><Schema Namespace="ODataWebApi.Models" xmlns="http://docs.oasis-open.org/odata/ns/edm"><EntityType Name="Poco"><Key><PropertyRef Name="Prop1" /></Key><Property Name="Prop1" Type="Edm.String" Nullable="false" /></EntityType></Schema><Schema Namespace="Default" xmlns="http://docs.oasis-open.org/odata/ns/edm"><EntityContainer Name="Container"><EntitySet Name="Format" EntityType="ODataWebApi.Models.Poco" /></EntityContainer></Schema></edmx:DataServices></edmx:Edmx>

Expected result

A container with an entity set named Format

Actual result

A container with an entity set named Format but does not compile due to errors in the constructor

Additional detail

Change the calls from this to base fixes the issue (the warnings about hiding an inherited property still remains)
https://github.com/OData/odata.net/blob/master/src/CodeGen/ODataT4CodeGenerator.ttinclude#L3196

@AlanWong-MS AlanWong-MS added the P4 label Apr 9, 2018
@madansr7 madansr7 added the client only related to OData.Client label Jun 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client only related to OData.Client P4
Projects
None yet
Development

No branches or pull requests

3 participants