Home > Net >  Why WebService using EntityFramework read in the database, the Model of navigation properties not av
Why WebService using EntityFramework read in the database, the Model of navigation properties not av

Time:11-06

A WebService EntityFramework do use in the database to add and delete, because there is a one-to-many mapping relationship, use DatabaseFirst mode to automatically generate the public virtual ICollection ClassD {get; set; Navigation attribute}, but strangely, in the project reference the WebService, access to the Model without the navigation properties, how be to return a responsibility excuse me? How to solve? Thank you very much! (interface can't series of problems have been resolved, change ICollection to List still appear this problem).

CodePudding user response:

WebService output do not use lazy loading, because in the WebService this layer transaction may already over, don't go to query the contents of the navigation, in addition, do not recommend the Entity directly to serialize the output, unless you are the type of Entity is not associated with simple, best again in one for the output of the web service model, this model after filling out to the web service output,

CodePudding user response:

As well as in the serialization, perhaps because of low navigation problem of infinite recursion, heap eventually lead to stack overflow
  • Related