Popularni postovi

Monday, 30 June 2014

WebAPI Self referencing loop detected with type 'System.Data.Entity.DynamicProxie


Turn OFF Lazy Loading  in your EDMX because it serializes childs with parent table and create referencing loop. If you need (but ONLY if YOU REALY NEED) Lazy Loading then add this to WebApiConfig(but it will send huge amount of data...):

            var json = config.Formatters.JsonFormatter;
            json.SerializerSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.Objects;
            json.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;

No comments:

Post a Comment