Как заставить SQLProvier работать на do tnet core 3.1 MySQL (фактически MariaDB)? - PullRequest
2 голосов
/ 27 января 2020

У меня есть проект do tnet core 3.1 со ссылкой nuget на SQLProvider, который пытается нацелиться на сервер MariaDB. Я добавил сделанный сообществом пакет MySqlConnector. Мой код F #

open FSharp.Data.Sql

[<Literal>]
let connString  = "Server=192.168.128.7;Database=market_data;Uid=****;Pwd=****;Port=3307;AllowLoadLocalInfile=true"

[<Literal>]
let dbVendor    = Common.DatabaseProviderTypes.MYSQL


[<Literal>]
let resPath = "__SOURCE_DIRECTORY__" + "/DLLs"

[<Literal>]
let useOptTypes = true

type sql = 
    SqlDataProvider<
        Common.DatabaseProviderTypes.MYSQL,
        connString,
        ResolutionPath = resPath,
        UseOptionTypes = useOptTypes>

И я получаю сообщение об ошибке

Severity    Code    Description Project File    Line    Suppression State
Error   FS3033  The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Details: 
Could not load type 'System.ICloneable' from assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Could not load type 'System.Data.Common.DbCommandBuilder' from assembly 'System.Data.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Could not load type 'System.Data.Common.DbDataAdapter' from assembly 'System.Data.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Could not load type 'System.Data.Common.RowUpdatingEventArgs' from assembly 'System.Data.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Could not load type 'System.Data.Common.RowUpdatedEventArgs' from assembly 'System.Data.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Could not load file or assembly 'System.Runtime.Extensions, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'System.Net.Primitives, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Could not load type 'System.ReadOnlyMemory`1' from assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Could not load type 'System.IO.Stream' from assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Could not load type 'System.ReadOnlySpan`1' from assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Could not load file or assembly 'System.Memory, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'System.Transactions.Local, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
Could not load type 'System.Runtime.CompilerServices.IAsyncStateMachine' from assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Could not load type 'System.Memory`1' from assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.    Analytics   OMMITED\Program.fs  23  Active

Я поместил файлы MySqlConnector.dll; 'System.Data.Odb c .dll'; 'System.Data.SqlClient.dll' в папке 'DLLs'. Это предлагается в качестве исправления из этой проблемы github .

Я попытался установить каждую сборку, упомянутую в ошибке. Не могу заставить его работать.

РЕДАКТИРОВАТЬ

Вот мой фрагмент fsproj

<ItemGroup>
    <PackageReference Include="MySqlConnector" Version="0.61.0" />
    <PackageReference Include="SQLProvider" Version="1.1.76" />
    <PackageReference Include="System.Console" Version="4.3.1" />
    <PackageReference Include="System.Data.Common" Version="4.3.0" />
    <PackageReference Include="System.Reflection" Version="4.3.0" />
    <PackageReference Include="System.Reflection.TypeExtensions" Version="4.7.0" />
    <PackageReference Include="System.Runtime" Version="4.3.1" />
    <PackageReference Include="System.Runtime.Extensions" Version="4.3.1" />
    <PackageReference Include="System.Runtime.Serialization.Formatters" Version="4.3.0" />
    <PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.3" />
  </ItemGroup>
...