title: How to use different c# primitive data types in EF Core Find method
body: <p>I am buidling an EF Core application. In my <code>dbContext</code> there are different models where primary key can be either <code>int</code> or <code>long</code> data type. I am using Generic repository pattern in my application.</p>
  <pre><code>public TEntityDto GetById(long id)
  {
      var entity = _context.Set&lt;TEntity&gt;().Find(id);
      return Mapper.Map&lt;TEntityDto&gt;(entity);
  }
  </code></pre>
  <p>I need to pass both <code>int</code> or <code>long</code> data type value. But if I passed a <code>int</code> data type value I am getting following error.</p>
  <blockquote>
  <p>The key value at position 0 of the call to 'DbSet&lt;&gt;.Find' was of type
  'long', which does not match the property type of 'int'.</p>
  </blockquote>
  <p>How can I use both <code>long</code> and <code>int</code> data type in Generic repository class ?</p>