You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[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
Closed
LaylaLiu opened this issue
Jul 27, 2015
· 3 comments
· Fixed by #333
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. “
The text was updated successfully, but these errors were encountered:
This issue can be solved by removing the internal "Context" property on BaseEntityType, as it is not presently being used. Separation of Concerns says that the Entity should need to know about the Context it came from anyways.
We probably should have named these internal properties such that they had a lower chance of conflicting with user properties. i.e., "__context" or some such.
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. “
The text was updated successfully, but these errors were encountered: