Entity Framework map model class to table at run time
问题 In a project using ASP.NET Core 2.0 and Entity Framework, I'm trying to map a known table schema (coded into class MyTableClass ) to an unknown table name. This table name is given by the user at run time, so this is done outside of the OnModelCreating method of the Context class. Is there a way to do something like the following pseudocode: void OnUserEnteredTableNameFromUI(string tableName) { var modelBuilder = new ModelBuilder(???); // how? modelBuilder.Entity<MyTableClass>().ToTable