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 Client failes to materialize a collection of dervied complex type into a collection of base complex type. #336

Closed
LaylaLiu opened this issue Sep 14, 2015 · 1 comment
Labels
Milestone

Comments

@LaylaLiu
Copy link
Contributor

Model:

<ComplexType Name="BaseComplexType" Abstract="true">
    <Property Name="AnyP" Type="Edm.String" />
  </ComplexType>
  <ComplexType Name="Address" BaseType="Service1.Models.BaseComplexType">
    <Property Name="Street" Type="Edm.String" />
  </ComplexType>
  <ComplexType Name="HomeAddress" BaseType="Service1.Models.Address">
    <Property Name="City" Type="Edm.String" />
  </ComplexType>
  <EntityType Name="Customer">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Type="Edm.Int32" Nullable="false" />
    <Property Name="Name" Type="Edm.String" />
    <Property Name="CompanyAddress" Type="Service1.Models.Address" />
    <Property Name="HomeAddress" Type="Service1.Models.HomeAddress" />
  </EntityType>
  <Function Name="AbstractNonP" IsBound="true">
    <Parameter Name="bindingParameter" Type="Collection(Service1.Models.Customer)" />
    <ReturnType Type="Collection(Service1.Models.BaseComplexType)" />
  </Function>
  <EntityContainer Name="Container">
    <EntitySet Name="Customers" EntityType="Service1.Models.Customer" />
  </EntityContainer>

Then if the context url in actually reponse playload of function AbstractNonP is like metadata#Collection(Service1.Models.Address). Client failes to materialize the payloads.

{
      "@odata.context":"http://localhost:13689/odata/$metadata#Collection(Service1.Models.Address)","value":[
        {
          "AnyP":null,"Street":"Zero Way"
        },{
          "AnyP":null,"Street":"One Way"
        },{
          "AnyP":null,"Street":"Two Way"
        },{
          "AnyP":null,"Street":"Three Way"
        }
      ]
    }
@LaylaLiu
Copy link
Contributor Author

Fixed by commit 883f5a6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants