linq to entities how to create database
问题 I'm new to linq to entities. In linqtosql you could do something like: datacontext.CreateDatabase() to generate a database from the model in sql. I'm wanting to do the same thing in linq to entities. Say I have a class MyEntities which inherits from ObjectContect is there a similiar method? 回答1: Try this // Create a builder and configure it var builder = new ContextBuilder<MyContext>(); … // Create a context var mycontext = builder.Create(sqlConnection); // Prepare the Context if (!myContext