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
Who are still facing this issue: check if you await
-ed all async methods.
I have tried your code in a new project and the second way seems to work well after installing the package Microsoft.AspNetCore.Mvc.NewtonsoftJson firstly for 3.0
services.AddControllersWithViews()
.AddNewtonsoftJson(options =>
options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
);
Try with a new project and compare the differences.