this is my Calendar Model which has many to many relation with Category Model:
public class Calendar
{
...
public ICollection<Category> Categories { get; set; } = new List<Category>();
...
}
public class Category
{
...
public ICollection<Calendar> Calendars { get; set; } = new List<Calendar>();
...
}
and this is in my OnModelCreating method:
modelBuilder.Entity<Calendar>()
.HasMany(c => c.Categories)
.WithMany(cc => cc.Calendars);
And this is in my Controller
var query = _context.Calendars.AsNoTracking().AsQueryable();
var calendars = await query.Include(c => c.Categories).ToArrayAsync();
return ok(calendars);
The result errors when browser try parse it to json