1. 下载EF6的源代码,运行build编译,Nuget会自动下载所需的DLL.
  2. 打开EF的工程,可以在EF解决方案下直接新建调试用的项目代码
  3. 添加EF引用时选择解决方案中的Entity Framework项目和SQLServer项目
  4. 修改配置文件
    1. 需要指定System.Data.SqlClient所在的Provide程序集,也就是在EntityFramework.SqlServer项目中
    2. 需要添加entityFramework Section定义

    3. 数据库配置信息
    4.  1 <configuration>
       2   <configSections>
       3     <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=64024bf7194bbc38" requirePermission="false" />
       4   </configSections>
       5   <startup>
       6     <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
       7   </startup>
       8   <connectionStrings>
       9     <add name="db" connectionString="Data Source=(localdb)\v11.0;Initial Catalog=School;Integrated Security=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False" providerName="System.Data.SqlClient" />
      10   </connectionStrings>
      11   <entityFramework>
      12     <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      13       <parameters>
      14         <parameter value="v11.0" />
      15       </parameters>
      16     </defaultConnectionFactory>
      17     <providers>
      18       <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
      19     </providers>
      20   </entityFramework>
      21 </configuration>
      View Code

相关文章:

  • 2022-12-23
  • 2021-08-30
  • 2021-07-30
  • 2021-12-31
  • 2021-12-09
  • 2021-11-08
  • 2021-12-11
  • 2021-09-14
猜你喜欢
  • 2022-01-08
  • 2021-11-15
  • 2021-11-24
  • 2018-06-15
  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
相关资源
相似解决方案