Asp.net 为什么和标记出现在我的web.config文件中?

Asp.net 为什么和标记出现在我的web.config文件中?,asp.net,asp.net-mvc,entity-framework,web-config,Asp.net,Asp.net Mvc,Entity Framework,Web Config,为什么此代码出现在我的web.config文件中?当我创建ADO.NET实体数据模型时它不在那里,那么是什么事件触发了此代码的生成 <configSections> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neu

为什么此代码出现在我的web.config文件中?当我创建ADO.NET实体数据模型时它不在那里,那么是什么事件触发了此代码的生成

  <configSections>
    <section name="entityFramework"
      type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
      requirePermission="false"/>
  </configSections>

  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb"/>
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
    </providers>
  </entityFramework>

实体框架包在多个实例中自动安装。例如,当您使用已启用个人身份验证的现成模板(如ASP.Net MVC project)创建项目时。因为在这种情况下,应用程序将与EF绑定,以处理所有与身份验证相关的DB交互。
其次,如果您添加了一个模型类和一个带有支架的控制器,以使用实体框架生成视图,那么MVC5控制器将使用实体框架生成视图。在这种情况下,如果实体框架尚未配置,则脚手架机制将执行该任务。因此,我们可以在项目中的web.config和DLL引用中看到所有与EF相关的配置。当我们在VisualStudio中开始处理这些新的项目模板时,这会导致一些混乱

您添加了EF nuget包了吗?是的,当我创建ADO.NET实体数据模型时,它会自动下载并通过NuGet@Will安装EntityFramework,就是这样。是的,我刚刚在Microsofts EntityFramework指南中读到了这一点。奇怪的是,我有另一个安装了EF6的项目,它没有将这些标记放在web.config文件中。这就是为什么我感到困惑。