When I write DbContext extension method, It doesn't work. I can't access to the method from DbContext object. What is the problem ?
namespace Data
{
public static class DbContextExtensions
{
public static bool AreThereAnyChanges(this DbContext context)
=> context.ChangeTracker
.Entries()
.Any(x => x.State == EntityState.Modified ||
x.State == EntityState.Added ||
x.State == EntityState.Deleted);
}
}
using Data;
namespace Demo
{
public partial class KybInfrastructureDemoDbContext : DbContext, IDatabaseContext
{
public KybInfrastructureDemoDbContext() { }
public KybInfrastructureDemoDbContext(DbContextOptions<KybInfrastructureDemoDbContext> options)
: base(options) {
// 'DbContext' does not contain a definition for 'AreThereAnyChanges'
bool change = base.AreThereAnyChanges();
}
}
}
DbContextExtensions.AreThereAnyChanges(base)?