title: Why does it create an Id field in the database again in C# coding?
body: <p>My bll codes:</p>
  <pre><code>        {
              return BaseList(filter, x =&gt; new KasaL
              {
                  Id = x.Id,
                  Kod = x.Kod,
                  KasaAdi = x.KasaAdi,
                  OzelKod1Adi = x.OzelKod1.OzelKodAdi,
                  OzelKod2Adi = x.OzelKod2.OzelKodAdi,
                  Aciklama = x.Aciklama,
                  BelgeNo=x.BelgeNo,
                  BenzersizKod=x.BenzersizKod,
                  DuzenlemeTarihi=x.DuzenlemeTarihi,
                  DuzenleyenKullaniciId=x.DuzenleyenKullaniciId,
                  FirmaId=x.FirmaId,
                  Internal=x.Internal,
                  KaydedenKullaniciId=x.KaydedenKullaniciId,
                  KayitTarihi=x.KayitTarihi,
                  ListeKodu=x.ListeKodu,
                  Sinternal=x.Sinternal,
                  TabloAdi=x.TabloAdi,
                  TabloKodu=x.TabloKodu,
                  Borc = x.KasaHareket.Where(y =&gt; y.KasaId == x.Id).GroupBy(y =&gt; y.KasaId).DefaultIfEmpty().Select(z =&gt; new { Borc = z.Select(a =&gt; a.Borc).DefaultIfEmpty(0).Sum() }).FirstOrDefault().Borc,
                  Alacak = x.KasaHareket.Where(y =&gt; y.KasaId == x.Id).GroupBy(y =&gt; y.KasaId).DefaultIfEmpty().Select(z =&gt; new { Alacak = z.Select(a =&gt; a.Alacak).DefaultIfEmpty(0).Sum() }).FirstOrDefault().Alacak,
                  Bakiye = x.KasaHareket.Where(y =&gt; y.KasaId == x.Id).GroupBy(y =&gt; y.KasaId).DefaultIfEmpty().Select(z =&gt; new { Borc = z.Select(a =&gt; a.Borc).DefaultIfEmpty(0).Sum() }).FirstOrDefault().Borc - x.KasaHareket.Where(y =&gt; y.KasaId == x.Id).GroupBy(y =&gt; y.KasaId).DefaultIfEmpty().Select(z =&gt; new { Alacak = z.Select(a =&gt; a.Alacak).DefaultIfEmpty(0).Sum() }).FirstOrDefault().Alacak
              }).OrderBy(x =&gt; x.Kod).ToList();
          } 
  </code></pre>
  <p>My DTO Codes:</p>
  <pre><code>public class KasaL : BaseEntity
      {
          public string KasaAdi { get; set; }
          public string OzelKod1Adi { get; set; }
          public string OzelKod2Adi { get; set; }
          public string Aciklama { get; set; }
          public decimal Borc { get; set; } = 0;
          public decimal Alacak { get; set; } = 0;
          public decimal Bakiye { get; set; } = 0;
  
      } 
  </code></pre>
  <p>My Entity Kasa Codes:</p>
  <pre><code>   public class Kasa : BaseEntityDurum
      {
          [Index(&quot;IX_Kod&quot;, IsUnique = false)]
          public override string Kod { get; set; }
          [Required, StringLength(100), ZorunluAlan(&quot;Kasa Adı&quot;, &quot;txtKasaAdi&quot;)]
          public string KasaAdi { get; set; }
          public long? OzelKod1Id { get; set; }
          public long? OzelKod2Id { get; set; }
          [StringLength(1000)]
          public string Aciklama { get; set; }
          public OzelKod OzelKod1 { get; set; }
          public OzelKod OzelKod2 { get; set; }
          public List&lt;KasaHareket&gt; KasaHareket { get; set; }
      }
  
  </code></pre>
  <p>My KasaHareket entity code:</p>
  <pre><code>   public class KasaHareket : BaseEntityDurum
      {
          [Index(&quot;IX_Kod&quot;, IsUnique = false)]
          public override string Kod { get; set; }
          [Column(TypeName = &quot;date&quot;)]
          public DateTime Tarih { get; set; }
          public int IslemYonu { get; set; }
          public long KasaId { get; set; }
          public long? CariId { get; set; }
          public long? BankaId { get; set; }
          public long? Kasa2Id { get; set; }
          public KartTuru KartTuru { get; set; }
          public CariIslemTuru CariIslemTuru { get; set; }
          public long? BaglantiId { get; set; }
          public DekontTuru DekontTuru { get; set; }
          public string Aciklama { get; set; }
          [Column(TypeName = &quot;money&quot;)]
          public decimal Borc { get; set; }
          [Column(TypeName = &quot;money&quot;)]
          public decimal Alacak { get; set; }
  
          public Kasa Kasa { get; set; }
          public BankaHesap Banka { get; set; }
          public Kasa Kasa2 { get; set; }
          public Cari Cari { get; set; }
      }
  </code></pre>
  <pre><code>Id  bigint  Unchecked
  Kod nvarchar(20)    Unchecked
  FirmaId bigint  Checked
  ListeKodu   nvarchar(20)    Checked
  TabloKodu   nvarchar(200)   Checked
  TabloAdi    nvarchar(200)   Checked
  Sinternal   nvarchar(500)   Checked
  Internal    int Checked
  BenzersizKod    nvarchar(500)   Checked
  KaydedenKullaniciId bigint  Checked
  KayitTarihi date    Unchecked
  DuzenleyenKullaniciId   bigint  Checked
  DuzenlemeTarihi date    Checked
  BelgeNo nvarchar(MAX)   Checked
  Tarih   date    Unchecked
  IslemYonu   int Unchecked
  KasaId  bigint  Unchecked
  CariId  bigint  Checked
  BankaId bigint  Checked
  Kasa2Id bigint  Checked
  KartTuru    tinyint Unchecked
  CariIslemTuru   tinyint Unchecked
  BaglantiId  bigint  Checked
  DekontTuru  tinyint Unchecked
  Aciklama    nvarchar(MAX)   Checked
  Borc    money   Unchecked
  Alacak  money   Unchecked
  Durum   bit Unchecked
  Kasa_Id tinyint Checked
  </code></pre>
  <p>When the migration is done, the Kasa_Id field is created automatically. When this field is created, collection operations are not performed.</p>
  <p>The <strong>Kasa_Id</strong> field is created automatically. This area should not exist.</p>
  <p>Can you help me?</p>
  <pre><code>    public class BaseEntityDurum : BaseEntity
      {
          public bool Durum { get; set; } = true;
      }
  </code></pre>
  <pre><code>    public class BaseEntity : IBaseEntity
      {
          [Column(Order =0),Key,DatabaseGenerated(DatabaseGeneratedOption.None)]
          public long Id { get; set; }
          [Column(Order = 1),Required,StringLength(20),Kod(&quot;Kod&quot;,&quot;txtKod&quot;),ZorunluAlan(&quot;Kod&quot;,&quot;txtKod&quot;)]
          public virtual string Kod { get; set; }
  
          [Column(Order = 2)]
          public virtual long? FirmaId { get; set; }
          [Column(Order = 3),  StringLength(20)]
          public string ListeKodu { get; set; }
          [Column(Order = 4), StringLength(200)]
          public string TabloKodu { get; set; }
          [Column(Order = 5), StringLength(200)]
          public string TabloAdi { get; set; }
          [Column(Order = 6), StringLength(500)]
          public string Sinternal { get; set; }
          [Column(Order = 7)]
          public int? Internal { get; set; }
          [Column(Order = 8), StringLength(500)]
          public string BenzersizKod { get; set; }
          [Column(Order = 9)]
          public long? KaydedenKullaniciId { get; set; }
          [Column(Order = 10,TypeName =&quot;date&quot;)]
          public DateTime KayitTarihi { get; set; } = DateTime.Now.Date;
          [Column(Order = 11)]
          public long? DuzenleyenKullaniciId { get; set; }
          [Column(Order = 12, TypeName = &quot;date&quot;)]
          public DateTime? DuzenlemeTarihi { get; set; }
          [Column(Order = 13)]
          public virtual string BelgeNo { get; set; }
      }
  </code></pre>
  <p>When I use the following aggregation operations in the Listing section of my bll codes, the Kasa_Id is generated.</p>
  <pre><code>           Borc = x.KasaHareket.Where(y =&gt; y.KasaId == x.Id).GroupBy(y =&gt; y.KasaId).DefaultIfEmpty().Select(z =&gt; new { Borc = z.Select(a =&gt; a.Borc).DefaultIfEmpty(0).Sum() }).FirstOrDefault().Borc,
                  Alacak = x.KasaHareket.Where(y =&gt; y.KasaId == x.Id).GroupBy(y =&gt; y.KasaId).DefaultIfEmpty().Select(z =&gt; new { Alacak = z.Select(a =&gt; a.Alacak).DefaultIfEmpty(0).Sum() }).FirstOrDefault().Alacak,
                  Bakiye = x.KasaHareket.Where(y =&gt; y.KasaId == x.Id).GroupBy(y =&gt; y.KasaId).DefaultIfEmpty().Select(z =&gt; new { Borc = z.Select(a =&gt; a.Borc).DefaultIfEmpty(0).Sum() }).FirstOrDefault().Borc - x.KasaHareket.Where(y =&gt; y.KasaId == x.Id).GroupBy(y =&gt; y.KasaId).DefaultIfEmpty().Select(z =&gt; new { Alacak = z.Select(a =&gt; a.Alacak).DefaultIfEmpty(0).Sum() }).FirstOrDefault().Alacak
             
  </code></pre>