source

SQL Provier를 dotnet core 3.1 MySQL(실제로는 MariaDB)에서 작동시키는 방법

manycodes 2022. 12. 25. 09:44
반응형

SQL Provier를 dotnet core 3.1 MySQL(실제로는 MariaDB)에서 작동시키는 방법

MariaDB 서버를 타겟으로 하는 SQLProvider에 대한 nuget 참조를 가진 dotnet core 3.1 프로젝트가 있습니다.커뮤니티에서 만든 패키지 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.Odbc.dll', '시스템'."DLLs" 폴더에 Data.SqlClient.dll이 있습니다.이것은 이 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>

언급URL : https://stackoverflow.com/questions/59931850/how-to-get-sqlprovier-to-work-on-dotnet-core-3-1-mysql-actually-mariadb

반응형