Entity Framework 6.2 very slow first startup and EFInteractiveViews

前端 未结 2 1986
甜味超标
甜味超标 2021-01-24 15:47

this topic is already widely discussed on stackoverflow and many other blogs, reason to asking question is that i observe this topic was discussed in mostly 3 to 5 years old pos

2条回答
  •  礼貌的吻别
    2021-01-24 16:10

    I want to know if these issues are updated in EF 6.2.0 or method of fixing it has changed, or any thing im doing wrong/should check.

    The answer is yes,

    EF 6.2 has introduced a Model Cache

    public class MyDbConfiguration : DbConfiguration
    {
        public MyDbConfiguration() : base()
        {
            var path = Path.GetDirectoryName(this.GetType().Assembly.Location);
            SetModelStore(new DefaultDbModelStore(path));
        }
    }
    
    [DbConfigurationType(typeof(MyDbConfiguration))]
    public class MyContextContext : DbContext 
    {
    }
    

    You can learn more here: https://codeopinion.com/entity-framework-code-first-model-cache/

提交回复
热议问题