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

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

Open
NicholasMiller opened this issue Dec 29, 2016 · 0 comments
Labels

Comments

@NicholasMiller
Copy link

NicholasMiller commented Dec 29, 2016

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.

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

2 participants