var sw = new Stopwatch();
sw.Start();
Database.SetInitializer(new DropCreateDatabaseIfModelChanges<ImgSimContext>());
using (var db = new ImgSimContext())
{
SqlConnection.ClearAllPools();
db.Database.Initialize(force: true);
sw.Stop();
Console.WriteLine("Booted in {0}ms", sw.ElapsedMilliseconds);
This takes about 2 seconds, even when the database has already been created. Is there any way I can speed it up?
如果使用的是EF6,则这是一个已知问题,如下所述: https : //entityframework.codeplex.com/workitem/1749
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.