将 linq2db 与 .net 核心一起使用时获得 "Could not load file or assembly 'System.EnterpriseServices""

Getting "Could not load file or assembly 'System.EnterpriseServices"" when using linq2db with .net core

我将 linq2db 与 .Net Core 一起使用,但在尝试连接数据库时出现以下问题:

Message = "Could not load file or assembly 'System.EnterpriseServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. An attempt was made to load a program with an incorrect format."

我试图通过手动导入我在这个位置找到的 dll 来解决这个问题:

C:\Windows\assembly\GAC_64\System.EnterpriseServices.0.0.0__b03f5f7f11d50a3a

但这没有用。

在此之前我遇到了类似的错误,但那是关于 Sybase.AdoNet2.AseClient,我解决了下载并添加对此 dll 的引用。

我不确定我是否做错了什么,但我已按照说明进行操作 here

我可以通过使用不同的连接方法来解决错误:

public MyContext() : base(new SybaseDataProvider("Core"), "You connection string here") { }

在此之前,我试图实现 ILinqToDBSettings 文件,但正如我在 linq2db 的代码中看到的那样,有一条关于不兼容的评论:

这不是 linq2db 问题。 Sybase 提供程序不支持 .net 核心,您需要为 .net 核心应用程序使用 DataAction 的 AdoNetCore.AseClient。 Linq2db 从 2.1.0 版本开始支持它:https://github.com/linq2db/linq2db/wiki/Releases-and-Roadmap#dataaction-adonetcoreaseclient-provider-support