I have the following interface that I used before EF7. When I try to build the application using EF7, I receive the following error, and I cannot seem to find this type anywhere. I'd really appreciate your suggestions about how to change this code for EF7.
Error CS0246 The type or namespace name 'DbEntityEntry' could not be found (are you missing a using directive or an assembly reference?)
public interface IContext
{
DbSet<Client> Clients { get; set; }
DbSet<TEntity> Set<TEntity>() where TEntity : class;
DbEntityEntry<TEntity> Entry<TEntity>(TEntity entity) where TEntity : class;
int SaveChanges();
}
There is no DbEntityEntry
type within Entity Framework 7. The whole underlying change tracking implementation has changed and there is no exact replication of this.
There is a EntityEntry
type within the new Microsoft.Data.Entity.ChangeTracking
namespace which has a similar purpose but it works a bit differently as is not compatible to the DbEntityEntry
type in earlier versions of Entity Framework.
You can access it from the ChangeTracker
which is accessible via DbContext.ChangeTracker
.
But as for keeping that interface, this is unlikely to help you as quite a few things has changed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With