However, this makes no sence since the interface obviously IS public. What could be the error here?
No, it isn't. Members on classes are private
by default. This Entities1
is private:
public class MyDbContext : DbContext, IDatabaseContext {
IDbSet<MyEntity1> Entities1 { get; set; }
}
Note that this is different to interface
s, where everything is public
and access modifiers do not make sense. So: either make the member public
:
public class MyDbContext : DbContext, IDatabaseContext {
public IDbSet<MyEntity1> Entities1 { get; set; }
}
or do an explicit interface implementation:
public class MyDbContext : DbContext, IDatabaseContext {
IDbSet<MyEntity1> IDatabaseContext.Entities1 { get; set; }
}