Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4828

Relationships with polymorphic and .net webapi

$
0
0

@nilssonan wrote:

So i have this simple structure where the project model has a DS.hasMany('question', {polymorphic: true'} and i all works fine. The derived types get materilized to the store. The paylod looks like this:

{
     project: 'some name',
     questions:  [
            {
                type: 'someType',
                someProp: 'someValue'
            },
            {
                type: 'someType',
                someOtherProp: 'someValue'
            }
        ]
    }
}

But using .net json serialization it adds type specific information and it mucks up the question array to this:

{
    $type: '.net type',
    project: 'some name',
    questions: {
        $type: '.net base type',
        $values: [
            {
                $type: '.net derived type',
                someProp: 'someValue'
            },
            {
                $type: '.net other derived type',
                someOtherProp: 'someValue'
            }
        ]
    }
}

So it breaks totally. questions is no longer an array but object with type and a values array. What hook do i need to override in the serializer in order to make the questions relation/deserialization work again?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles