简体   繁体   中英

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

I'm using linq2db with .Net Core, but I'm getting the follow when trying to connect with database:

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."

I tried to solve this by importing manually the dll that I've found at this location:

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

But that didn't work.

Before that I was getting a similar error, but that was about the Sybase.AdoNet2.AseClient , I solved downloading and adding the reference to this dll .

I'm not sure if I'm doing something wrong, but I've follow the instructions here

This is not a linq2db issue. Sybase provider doesn't support .net core and you need to use DataAction's AdoNetCore.AseClient for .net core applications. Linq2db supports it starting from version 2.1.0 : https://github.com/linq2db/linq2db/wiki/Releases-and-Roadmap#dataaction-adonetcoreaseclient-provider-support

I could solve the error by using a different approach to connect:

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

Before that I was trying to implement the ILinqToDBSettings file, but as I saw inside the code of linq2db there is a comment about that incompatibility:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM