How to force fire OnModelCreating every DataContext initialized up
问题 I want to fire OnModelCreating every new DataContext(new Entity()) ... But when i create a connection of a table , it works. When create a connection for another table, OnModelCreating doesnt work again, so because i got error, the entity type <tableName> is not part of the model for the current context. public class DataContext : DbContext { private BaseEntity _entity; public DataContext(BaseEntity entity) { Database.Connection.ConnectionString = Parameters.ConnectionString; _entity = entity