有没有办法使用此答案中描述的方法No FindAsync() method on IDbSet for DbSet properties of a DbContext?
编辑:
链接的答案包含如何构建从 IDbSet 继承的接口并添加对 DbSet 类的 SearchAsync 方法的支持的描述。我了解 Keith Payne 所写的所有内容,但我不知道如何在 DbContext 中使用它。
例如,我有一个看起来像这样的 DbContext:
public class MyContext : DbContext
{
public DbSet<Customer> Customers { get; set; }
}
如何使用 MyDbSet (答案中描述的类。)或类似的类,而不是 DbSet?
public class MyContext : DbContext
{
public MyDbSet<Customer> Customers { get; set; }
}
现在的问题是,Entity Framework 似乎只为 IDbSet 或 DbSet 类型的属性生成表。