title: Primary Key attribute name is different in Generic Repository Pattern
body: <p>I have multiple tables in database and for each table the primary key is long and the id column name is not generic i.e. each table primary key column name is different. </p>
  
  <p>For example:</p>
  
  <ul>
  <li>Table <code>Customer</code> has primary key as 'CustomerId'</li>
  <li>Table <code>Employee</code> has primary key as 'EmployeeId' </li>
  </ul>
  
  <p>And same get represented in the domain model class </p>
  
  <pre><code>class Customer { public long CustomerId { get; set; } 
  
  class Employee { public long EmployeeId { get; set; }
  </code></pre>
  
  <p>How do I refer in primary key to get values based on different primary key name. </p>
  
  <pre><code>public async Task&lt;TEntity&gt; GetById(int id)
  {
      return await _dbContext.Set&lt;TEntity&gt;()
                  .AsNoTracking()
                  .FirstOrDefaultAsync(e =&gt; e.**Id** == id);
  }
  </code></pre>
  
  <p><code>Id</code> can be <code>CustomerId</code> or <code>EmployeeId</code></p>