Unloaded “eager-loaded” properties causing issues when returning json'd data

前端 未结 1 1212
谎友^
谎友^ 2021-01-12 05:03

Hopefully the title makes sense, I\'ll do my best to describe my problem.

I\'m currently developing an ASP.NET Web API. In my \"Company\" controller I have a GetComp

相关标签:
1条回答
  • 2021-01-12 05:19

    The proxy is causing the serializer to attempt to access navigational properties which are no longer available since the context has been disposed.

    Try removing the proxy and eager loading from your context when you are querying for objects that will be serialized

     context.Configuration.ProxyCreationEnabled = false;
     context.Configuration.LazyLoadingEnabled = false;
    
    0 讨论(0)
提交回复
热议问题