I have a mssql database for my website within 4 tables.
When I use this:
public static string GetAllEventsForJSON()
{
using (CyberDBDataContext db = new CyberDBDataContext())
{
return JsonConvert.SerializeObject((from a in db.Events where a.Active select a).ToList(), new JavaScriptDateTimeConverter());
}
}
The code results in the following error:
Newtonsoft.Json.JsonSerializationException: Self referencing loop detected for property 'CyberUser' with type 'DAL.CyberUser'. Path '[0].EventRegistrations[0].CyberUser.UserLogs[0]'.