.Net Core 3.0 possible object cycle was detected which is not supported

前端 未结 8 1714
我寻月下人不归
我寻月下人不归 2020-12-02 09:27

I have 2 entities that are related as one to many

public class Restaurant {
   public int RestaurantId {get;set;}
   public string Name {get;set;}
   public          


        
8条回答
  •  忘掉有多难
    2020-12-02 10:20

    This happens because of the 2 way relationship between your data model when it comes to be JSON serialized.

    You should not return your data model diectly. Map it to a new response model then return it.

提交回复
热议问题