title: Entity Framework 7 Create in-memory implementation of DbSet
body: <p>Sorry I am new to Entity Framework..</p>
  
  <p>I want to  created a TestDbSet that provides an in-memory implementation of DbSet in EF 7.</p>
  
  <pre><code>public class TestDbSet&lt;TEntity&gt; : DbSet&lt;TEntity&gt;, IQueryable, IEnumerable&lt;TEntity&gt;, IDbAsyncEnumerable&lt;TEntity&gt; 
          where TEntity : class 
      { 
          ObservableCollection&lt;TEntity&gt; _data; 
          IQueryable _query; 
  
  
      public TestDbSet() 
      { 
          _data = new ObservableCollection&lt;TEntity&gt;(); 
          _query = _data.AsQueryable(); 
      } 
  
      public override TEntity Add(TEntity item) 
      { 
          _data.Add(item); 
          return item; 
      } 
  
      public override TEntity Remove(TEntity item) 
      { 
          _data.Remove(item); 
          return item; 
          } 
   }
  </code></pre>
  
  <p>I am getting error in Add method that return type must be <code>EntityEntry&lt;T&gt;</code> to match Overriden Dbset member.</p>
  
  <p>I tried to change method signature but I am not sure how to return item as EntityEntry</p>
  
  <pre><code> public override EntityEntry&lt;T&gt; Add(T item) 
          {
             _data.Add(item);
              return  item;
          }
  </code></pre>
  
  <p>I could not find similar issue. Can you guide me how we implement in EF 7.. I know it will work in EF 6.. </p>