This fixes a bug introduced (by me) in v8.0.0-Beta1, which caused ReadonlyDbContext.OnModelCreating to only fire once per domain. This is because OnModelCreating only fires once per custom DbContext derivative. By inheriting from DbContext, rather than having a private instance of it, each final ReadonlyDomainRepository will wind up invoking OnModelCreating.
There are ways around this, primarily by implementing IDbModelCacheKeyProvider, but this approach moves the ReadonlyDataContext back inline with what the original Highway.Data.DataContext does. I prefer this approach for now, and recommended revisiting the inheritance / composition concern for EF Core.
This fixes a bug introduced (by me) in v8.0.0-Beta1, which caused ReadonlyDbContext.OnModelCreating to only fire once per domain. This is because OnModelCreating only fires once per custom DbContext derivative. By inheriting from DbContext, rather than having a private instance of it, each final ReadonlyDomainRepository will wind up invoking OnModelCreating.
There are ways around this, primarily by implementing IDbModelCacheKeyProvider, but this approach moves the ReadonlyDataContext back inline with what the original Highway.Data.DataContext does. I prefer this approach for now, and recommended revisiting the inheritance / composition concern for EF Core.
https://stackoverflow.com/questions/33076291/onmodelcreating-is-never-called