0

When I was trying to send the JSON object to the jQuery, I return the whole query result , then I get an error saying " A circular reference was detected while serializing an object of type 'aspnet_User'." However when I return parts of the table like

       select  new
                     {
                         n.CustomerID,
                         n.EndDate,
                         n.BeginDate
                     });
        });

in this case I can see the values being retrieved. Please help me with the problem?

1 Answer 1

2

If you have a set of classes like

class User {
   Account account;
}
class Account {
  User user;
}

And you send them to a serializer, then then serializer will forever be in a loop. It will serialize User -> User's Account -> Account's User -> User's Account. The serializer detects this problem and throws and error. Instead if you have User with no account or Account with no user it shouldn't be a problem.

Sign up to request clarification or add additional context in comments.

1 Comment

Decouple the circular reference. Or come up with another class that doesn't have the reference. Circular references are bad.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.