Skip to content

Serializing multiple properties of the same type results in an error #35

@NicholasMiller

Description

@NicholasMiller

Serialization will fail if a model contains multiple linked entities of the same type. Take the following simple example:

public class PersonModel
{
    public int Id { get; set; }
    public String FirstName { get; set; }
    public String LastName { get; set; }
}

public class MusicLessonModel
{
    public DateTime Date { get; set; }
    
    public int TeacherPersonId  { get; set; }
    public PersonModel TeacherPerson { get; set; }
    
    // This is where your bad day begins :)
    public int StudentPersonId  { get; set; }
    public PersonModel StudentPerson { get; set; }
}

Assuming the appropriate controllers have been configured etc, calling http://hostname/music-lessons?include=person results in an exception being raised prior to my code change in PR #34.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions