Repository generic method GetById using eager loading
<p>I am using Entity Framework and would like to create generic <strong>GetById</strong> method in Repository class with eager loading:</p>

<p>Here is my method which uses lazy-loading:</p>

<pre><code>public virtual TEntity GetById(object id)
  {
    return DbSet.Find(id);
  }
</code></pre>

<p>I know method <strong>Find</strong> does not support eager loading, but how it is possible to modify this method to use eager loading, so that I use this method as follows(for an example):</p>

<pre><code>_unitOfWork.MyRepository.GetById(includeProperties: "Users");
</code></pre>