title: Do I need entity data model in OnModelCreating for runtime DB context?
body: <p>So, I'm using EF DbContexts in the following way. One <code>AppDbContext</code> is an abstract class derived from <code>DbContext</code>, it contains my DbSets and is used as a type to inject into services. Its &quot;implementation&quot; is like <code>AppDbContextMySql</code>, which is self-explanatory - it's derived from <code>AppDbContext</code> and handles the connection to the actual DB. There can be several such abstract/implementation pairs to separate the data tables, but usually, all of them point to the same actual DB instance.</p>
  <p>Then I need to migrate it all, so I add a <code>MigrationDbContext</code> implementing all the datasets and all the entity configurations needed, namely composite primary keys which can only be configured in <code>OnModelCreating</code> override.</p>
  <p>The question is, if I already have the data model configuration in <code>MigrationDbContext</code>, have applied the migration successfully to the DB, and it's DB's job to handle keys and indexes anyway, do I need to have the model configuration in my actually consumed <code>AppDbContext</code> or <code>AppDbContextMySql</code>? In other words, is the model only used to generate migration scripts, or is it also needed at runtime to help EF handle the data in any way?</p>