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. 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; }

Here is a picture of my DB schema:

Enter image details here

If you are using the code first playlist model and 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

Popular posts from this blog

python - how we can use ajax() in views.py in django? -

matlab - Using loops to get multiple values into a cell -

python - Sequence Pattern recognition with Pybrain -