我使用:
Visual Studio 2017;
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
;
实体框架 - 6.1.4;
JetEntityFrameworkProvider - 6.2.0;
赢表格;
微软访问 - 2016;
数据库 - db.accdb;
表 - 项目、任务。
通过 Nuget 安装的 EntityFramework、JetEntityFrameworkProvider。
文件App.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
我更改了文件machine.config
:
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config
<DbProviderFactories>
<add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
<add name="JetEntityFrameworkProvider" invariant="JetEntityFrameworkProvider" description="JetEntityFrameworkProvider" type="JetEntityFrameworkProvider.JetProviderFactory, JetEntityFrameworkProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=756cf6beb8fe7b41" />
</DbProviderFactories>
复制项目(F6)。
问题。
如何通过 Entity Framework 和 JetEntityFrameworkProvider 连接到 Access (*.accdb)?
Update_2我在https://github.com/bubibubi/JetEntityFrameworkProvider
下载了项目
对于项目“JetDdexProvider”做了“分配一个启动项目”
按F6
收到错误
*错误
退出“%ProgramFiles%\Microsoft SDKs\Windows\v8.0A\Bin\NETFX 4.0 Tools\gacutil.exe”/u“JetEntityFrameworkProvider”,代码为 3。
从命令“调用”C:\Program Files (x86)\Microsoft Visual Studio\2017\Community2\Common7\IDE\..\Tools\vsvars32.bat“gacutil/u JetEntityFrameworkProvider.dll”退出时出错 ,代码为 9009。JetDdexProvider
错误 CS0006
找不到元数据文件“Z:\vs\csharp\dll\JetEntityFrameworkProvider\2018.05.16\fl\Debug\JetEntityFrameworkProvider.dll”。JetEntityFrameworkProvider.Test Z:\vs\csharp\dll\JetEntityFrameworkProvider\2018.05.16\fl\JetEntityFrameworkProvider.Test\CSC 1
错误 CS0006
找不到元数据文件“Z:\vs\csharp\dll\JetEntityFrameworkProvider\2018.05.16\fl\Debug\JetEntityFrameworkProvider.dll”。JetEntityFrameworkProvider.Utilities Z:\vs\csharp\dll\JetEntityFrameworkProvider\2018.05.16\fl\JetEntityFrameworkProvider.Utilities\CSC*