Skip to content
This repository was archived by the owner on Apr 11, 2023. It is now read-only.
This repository was archived by the owner on Apr 11, 2023. It is now read-only.

Odata and inherited types - multiple levels of inheritance, data not populated. JayData 1.5.6 (release) #274

Description

@radicalapps

I have a data model in which there are is more than one level of inheritance. Jaydata 1.5.6 does not populate the data entities correctly.

Scenario: Make a simple query (toArray) to retrieve Groups from my OData Context. The OData query runs as expected, and I can use Fiddler to see that the data is returned from the service as expected. However, JayData is only populating the data fields in the most-derived level of the class hierarchy.

Observed behaviour:
In an inheritance hierarchy MostDerived->Derived->Base->$data.Entity, only the data fields of the class "MostDerived" are populated. The fields that belong to "Derived" and "Base" are undefined.

Expected behaviour:
In an inheritance hierarchy MostDerived->Derived->Base->$data.Entity, the data fields at all levels of the class hierarchy should be populated with data values.

My class hierarchy is below.

types["MyApp.Models.Group"] = $data("$data.Entity").extend("MyApp.Models.Group", {
    Id: {
        "type": "Edm.Int32",
        "nullable": false,
        "required": true,
        "key": true
    },
    Guid: {
        "type": "Edm.Guid"
    },
    Name: {
        "type": "Edm.String"
    },
    Roles: {
        "type": "Array",
        "elementType": "MyApp.Models.GroupRole",
        "inverseProperty": "$$unbound"
    },
    Assignments: {
        "type": "Array",
        "elementType": "MyApp.Models.GroupAssignment",
        "inverseProperty": "$$unbound"
    }
});

types["MyApp.Models.ParentGroup"] = types["MyApp.Models.Group"].extend("MyApp.Models.ParentGroup", {
    Groups: {
        "type": "Array",
        "elementType": "MyApp.Models.MemberGroup",
        "inverseProperty": "$$unbound"
    }
});

types["MyApp.Models.EstablishmentGroup"] = types["MyApp.Models.ParentGroup"].extend("MyApp.Models.EstablishmentGroup", {
    EstablishmentGuid: {
        "type": "Edm.Guid"
    },
    EstablishmentId: {
        "type": "Edm.Int32"
    },
    Parent: {
        "type": "MyApp.Models.Establishment",
        "inverseProperty": "$$unbound"
    }
});

types["MyApp.Models.MemberGroup"] = types["MyApp.Models.ParentGroup"].extend("MyApp.Models.MemberGroup", {
    ParentGroupId: {
        "type": "Edm.Int32"
    },
    Parent: {
        "type": "MyApp.Models.ParentGroup",
        "inverseProperty": "$$unbound"
    }
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions