Skip to content
This repository has been 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

Open
radicalapps opened this issue Oct 21, 2016 · 0 comments

Comments

@radicalapps
Copy link

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"
    }
});
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant