Skip to content

[T4] OData v4 Client Code Generator generates a C# proxy class that won’t compile if the model contains an Entity that has a property with name "Context" #242

@LaylaLiu

Description

@LaylaLiu

BaseEntityType contains a property named "Context".

So when a model contains an entity which has a property named "Context". The client generated code will be like

public partial class Product : global::Microsoft.OData.Client.BaseEntityType
{
...
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.1.0")]
[global::Microsoft.OData.Client.OriginalNameAttribute("Context")]
public global::System.Collections.ObjectModel.ObservableCollectionglobal::OutlookApiBetaModel.CustomProperty Context
{
get { ... }
set { ... }
}

This will lead to "ConsoleApplication7.Product.Context' hides inherited member 'Microsoft.OData.Client.BaseEntityType.Context'. Use the new keyword if hiding was intended. “

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlogbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions