c# - "Circular Reference" exception when serializing database object -
I get an error stating that circular references were detected while serializing the type of object I believe that I have something with the database and I have a set of PK and FK. Here is a picture of my DB schema: If you are using the code first Public string GetSongs (int playlistId) {var songs = (_db.Songs by song where song.PlaylistId == playlistlist select song). List (); Var serializer = new JavaScriptSerializer (); Var json = serializer.Serialize (song); // error message here json back; }
playlist to
song in the
user keyword by keyword . Because
playlist load your
user model automatically and your
playlist is
user and loop is turned on .
Comments
Post a Comment