C# EF 4.1 Create table dynamically within DbContext
问题 I want to add tables to a SQLCe database at runtime, since the tablenames are not static and known at compile time. I try to do this with Entity Framework 4.1 and DbContext as follows: public class PersonContext : DbContext { public PersonContext() : base("UnicornsCEDatabase") { } } public class Person { public int NameId { get; set; } public string Name { get; set; } } public class Program { static void Main(string[] args) { using (var db = new PersonContext()) { db.Database.Delete(); //Try