title: How correctly use Include in EF Core
body: <p>i have models</p>
  <pre><code>public class ProductModel
  {
      public int ProductId { get; set; }
      
      public int BrandId { get; set; }
      [ForeignKey(&quot;BrandId&quot;)]
      public virtual BrandModel Brand { get; set; }
  }
  </code></pre>
  <p>and</p>
  <pre><code>public class BrandModel
  {
      public int BrandId { get; set; }
      public string BrandName { get; set; }
     
      public ProductModel Product { get; set; }
  }
  </code></pre>
  <p>my context</p>
  <pre><code>public class ApplicationContext : DbContext
  {
      public ApplicationContext(DbContextOptions&lt;ApplicationContext&gt; options) : base(options)
      {
      }
      public DbSet&lt;BrandModel&gt; Brand { get; set; }
      public DbSet&lt;ProductModel&gt; Product { get; set; }
  
      protected override void OnModelCreating(ModelBuilder modelBuilder)
      {
          modelBuilder.Entity&lt;BrandModel&gt;().ToTable(&quot;Brand&quot;).HasKey(k=&gt;k.BrandId);
          modelBuilder.Entity&lt;BrandModel&gt;().Property(p =&gt; p.BrandId).IsRequired().HasMaxLength(30);
  
          modelBuilder.Entity&lt;ProductModel&gt;().ToTable(&quot;Product&quot;).HasKey(k =&gt; k.ProductId);
  
          modelBuilder.Entity&lt;ProductModel&gt;()
              .HasOne&lt;BrandModel&gt;(p =&gt; p.Brand)
              .WithOne(b =&gt; b.Product)
              .HasForeignKey&lt;ProductModel&gt;(pr =&gt; pr.BrandId);
      }
  }
  </code></pre>
  <p>i want take products with Brand. 1 product have 1 brand
  then i make simple method with include</p>
  <pre><code>var result = await _context.Product.Include(x =&gt; x.Brand).ToListAsync();
  </code></pre>
  <p>i see data from the database, but there is a loop</p>
  <pre><code>System.Text.Json.JsonException: A possible object cycle was detected which is not supported. This can either be due to a cycle or if the object depth is larger than the maximum allowed depth of 32.
  </code></pre>
  <p>it finds a product with a brand, but the brand has a product model that has a brand model ...</p>
  <p>how can you remove this loop and get a product with a brand?</p>