使用MySQL在F#中配置SQLProvider时遇到问题 [英] Having trouble configuring SQLProvider in F# with MySQL

查看:54
本文介绍了使用MySQL在F#中配置SQLProvider时遇到问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是刚成立并将F#代码库连接到MySQL数据库的人.到目前为止,这些是我已经采取的以下步骤.

I'm new to set up and connect my F# code base to a MySQL database. So far, these are the following steps I've taken.

  1. 简单安装mysql
  2. 设置并创建用户名/密码&数据库并启动了mysql服务器
  3. 通过NuGet安装了SQLProvider
  4. 我去了 http://dev.mysql.com/downloads/connector/net/1.0.html 并下载了MySql.Data.dll
  5. 我拿了MySql.Data.dll并将其移至 {proj_path}/packages/SQLProvider.1.0.22/lib
  1. brew install mysql
  2. set up and created username/password & database and started mysql server
  3. installed SQLProvider through NuGet
  4. I went to http://dev.mysql.com/downloads/connector/net/1.0.html and downloaded the MySql.Data.dll
  5. I took the MySql.Data.dll and moved it into {proj_path}/packages/SQLProvider.1.0.22/lib

我有以下代码

namespace lukecxufs
open FSharp.Data.Sql

module test = 

  let [<Literal>] resolutionPath = __SOURCE_DIRECTORY__
  let [<Literal>] connectionString = "Data Source=localhost"
  type sql = SqlDataProvider< 
              ConnectionString = connectionString,
              DatabaseVendor = Common.DatabaseProviderTypes.MYSQL,
              ResolutionPath = resolutionPath,
              IndividualsAmount = 1000,
              UseOptionTypes = true >

我一直在说一个错误

无法解析程序集.MySql.Data.dll之一必须存在于路径中
{proj_path}/lukecxufs ../../files/sqlite
{proj_path}/packages/SQLProvider.1.0.22/lib

此外,如果使用单声道,我正在使用单声道

这是我下面的文件夹结构.

Here's my folder structure below.

├── api
│   ├── AssemblyInfo.fs
│   ├── Program.fs
│   ├── api.fsproj
│   ├── bin
│   │   └── Debug
│   │       ├── FSharp.Data.SqlProvider.dll
│   │       ├── Suave.dll
│   │       ├── api.exe
│   │       └── api.exe.mdb
│   ├── obj
│   │   └── x86
│   │       └── Debug
│   │           ├── api.exe
│   │           ├── api.exe.mdb
│   │           └── api.fsproj.FilesWrittenAbsolute.txt
│   └── paket.references
├── api.sln
├── api.userprefs
├── packages
│   ├── FSharp.Core
│   │   ├── FSharp.Core.4.0.0.1.nupkg
│   │   ├── FSharp.Core.nuspec
│   │   ├── [Content_Types].xml
│   │   ├── _rels
│   │   ├── lib
│   │   │   ├── net20
│   │   │   │   ├── FSharp.Core.dll
│   │   │   │   ├── FSharp.Core.optdata
│   │   │   │   ├── FSharp.Core.sigdata
│   │   │   │   └── FSharp.Core.xml
│   │   │   ├── net40
│   │   │   │   ├── FSharp.Core.dll
│   │   │   │   ├── FSharp.Core.optdata
│   │   │   │   ├── FSharp.Core.sigdata
│   │   │   │   └── FSharp.Core.xml
│   │   │   ├── portable-net45+monoandroid10+monotouch10+xamarinios10
│   │   │   │   ├── FSharp.Core.dll
│   │   │   │   ├── FSharp.Core.optdata
│   │   │   │   ├── FSharp.Core.sigdata
│   │   │   │   └── FSharp.Core.xml
│   │   │   ├── portable-net45+netcore45
│   │   │   │   ├── FSharp.Core.dll
│   │   │   │   ├── FSharp.Core.optdata
│   │   │   │   ├── FSharp.Core.sigdata
│   │   │   │   └── FSharp.Core.xml
│   │   │   ├── portable-net45+netcore45+wp8
│   │   │   │   ├── FSharp.Core.dll
│   │   │   │   ├── FSharp.Core.optdata
│   │   │   │   ├── FSharp.Core.sigdata
│   │   │   │   └── FSharp.Core.xml
│   │   │   ├── portable-net45+netcore45+wpa81+wp8
│   │   │   │   ├── FSharp.Core.dll
│   │   │   │   ├── FSharp.Core.optdata
│   │   │   │   ├── FSharp.Core.sigdata
│   │   │   │   └── FSharp.Core.xml
│   │   │   └── portable-net45+sl5+netcore45
│   │   │       ├── FSharp.Core.dll
│   │   │       ├── FSharp.Core.optdata
│   │   │       ├── FSharp.Core.sigdata
│   │   │       └── FSharp.Core.xml
│   │   └── package
│   │       └── services
│   │           └── metadata
│   │               └── core-properties
│   │                   └── bb309a7e309548529b66e5b42059dbb1.psmdcp
│   ├── MySql.Data
│   │   ├── CHANGES
│   │   ├── MySql.Data.6.9.9.nupkg
│   │   ├── MySql.Data.nuspec
│   │   ├── Readme.txt
│   │   ├── [Content_Types].xml
│   │   ├── _rels
│   │   ├── content
│   │   │   ├── app.config.transform
│   │   │   └── web.config.transform
│   │   ├── lib
│   │   │   ├── net40
│   │   │   │   └── MySql.Data.dll
│   │   │   └── net45
│   │   │       └── MySql.Data.dll
│   │   ├── license.html
│   │   └── package
│   │       └── services
│   │           └── metadata
│   │               └── core-properties
│   │                   └── 8a5d4fe3e48745aea7a6ec39787d6703.psmdcp
│   ├── SQLProvider
│   │   ├── SQLProvider.1.0.22.nupkg
│   │   ├── SQLProvider.nuspec
│   │   ├── [Content_Types].xml
│   │   ├── _rels
│   │   ├── lib
│   │   │   └── FSharp.Data.SqlProvider.dll
│   │   └── package
│   │       └── services
│   │           └── metadata
│   │               └── core-properties
│   │                   └── addc797a97984054a5bf88ae510977a5.psmdcp
│   └── Suave
│       ├── Suave.1.1.3.nupkg
│       ├── Suave.nuspec
│       ├── [Content_Types].xml
│       ├── _rels
│       ├── lib
│       │   └── net40
│       │       ├── Suave.dll
│       │       ├── Suave.pdb
│       │       └── Suave.xml
│       └── package
│           └── services
│               └── metadata
│                   └── core-properties
│                       └── bfd111f5611143d39dfd308db403a690.psmdcp
├── paket.dependencies
└── paket.lock

推荐答案

我认为resolutionPath可能不正确,因为您应该将位置指定给MySql.Data.dll文件,您可以尝试

I think the resolutionPath might be incorrect since you are supposed to give location to MySql.Data.dll file, could you try

let [<Literal>] resolutionPath = __SOURCE_DIRECTORY__ + "/packages/SQLProvider.1.0.22/lib/"

看看是否有帮助?

这篇关于使用MySQL在F#中配置SQLProvider时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆