Question

I'm using the single page application template in MVC 4. The template created the following:

    public partial class SSOController : DbDataController<Softdocs.SSOWeb.SSOContext>
{

    public IQueryable<Softdocs.SSOWeb.Models.User> GetUsers() {
        return DbContext.Users.Include("Groups").OrderBy(u => u.UseName);
    }
    . . . 
}

I added the ".Include("Groups")" to populate the collection representing the m2m between Groups and Users. This resulted in receiving the following error on the client

Object graph for type contains cycles and cannot be serialized if reference tracking is disabled

This appears to be a longstanding issue that can be resolved in WCF by either decorating the method with [CyclicReferencesAware(true)] or [DataContract(IsReference = true)].

Any ideas on how to resolve this with DdDataController (ASP.Net Web Api) would be very much appreciated.

Was it helpful?

Solution

I've had a similar issue, apparently it's a general problem in the beta WebApi that Microsoft are aware of. forum post of similar problem

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top