OData / OData/AspNetCoreOData

OData registers generic type definition/parameter as EDM types

Open
#910 2 comments 1 reaction 1 assignee View on GitHub

@gathogojr is already working on this.

Since May 9, 2023.

followup
Dominant language
C#
Stars
505
Forks
186
PR merge metrics
No merged PRs in 30d

Description

When there's a generic EDM type that is derived from other type:

namespace Model
{
    public class BaseType { }
    public class GenericType<T> : BaseType
    {
        public T Data { get; set; }
    }
}

and if both are registered as complex types, basically:


modelBuilder.AddComplexType<BaseType>();
modelBuilder.AddComplexType<GenericType<string>>();
var model = modelBuilder.GetEdmModel();

then OData also registers generic type definition/parameter when it's building the model, so as result EDM metadata contain the following:

<ComplexType Name="GenericType_1OfT" BaseType="Model.BaseType">
  <Property Name="Data" Type="Model.T"/>
</ComplexType>
<ComplexType Name="T"/>

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.