Fluent Nhibernate 与 MySQL 的连接字符串
我已经阅读了这篇文章How to configure Fluent NHibernate with MySQL,但我对 MySQL 比较陌生,我需要实际设置连接字符串本身。我已将 MySQL 作为 WAMP 安装的一部分进行安装,并且需要填写实际的连接字符串。有人可以帮助我扩展链接的答案以实际包含完整的连接字符串示例吗?
赞赏。
编辑:我尝试了几种不同的方法,但不断收到以下错误消息:
Can't load file FluentConfiguration.cs under d:\Builds\FluentNH-v1.x-nh3\src\FluentNHibernate\Cfg.
Check the file permission and the existence of that file.
我通过 nuget 安装了 FNH,但我不明白为什么它会查看该路径,因为 d: 驱动器是我的CD而不是硬盘。很困惑。
I've reviewed the post How to configure Fluent NHibernate with MySQL, but I'm relatively new to MySQL and I need to actually set up with connection string itself. I've installed MySQL as part of a WAMP install and need to fill in the actual connection string. Can someone help me by extending the linked answer to actually contain a full connection string example?
Appreciated.
Edit: I've tried several different things and I keep getting the following error message:
Can't load file FluentConfiguration.cs under d:\Builds\FluentNH-v1.x-nh3\src\FluentNHibernate\Cfg.
Check the file permission and the existence of that file.
I installed FNH via nuget, and I don't understand why it's looking at that path, as the d: drive is my CD and not a harddisk. Very confused.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您粘贴的错误看起来像是 Visual Studio 试图本地化源以向您显示异常的来源。这不是真正的异常消息 - 你应该把它放在某个地方,它可能与错误的配置有关。
如果您使用默认设置安装了 WAMP,它会配置为侦听 3306 端口,并且只有本地
root
帐户而无需密码。所以你的连接字符串应该看起来像这样:(Pwd=
部分可能根本不需要)。因此,您需要将其粘贴到
App.config
/Web.config
的
部分:然后使用以下解决方案链接的问题:
或者,您可以直接将连接字符串粘贴到 Fluent 的配置中,如下所示:
无论如何,此默认 root/无密码配置只能用于本地开发和测试目的。
The error you've pasted looks like Visual Studio trying to localise the sources to show you where the exception comes from. This is not the real exception message - you should have it somewhere there and it's probably something about wrong configuration.
If you've installed WAMP with default settings, it is configured to listen on 3306 port and have only local
root
account without password. So your connection string should look somehow like that:(
Pwd=
part may be not needed at all).So you need to paste it in your
App.config
/Web.config
's<connectionStrings>
section:and then use the solution from linked question:
Alternatively, you can paste the connection string directly in your Fluent's configuration, like this:
Anyway, this default root/no password configuration can be used only for local development and testing purposes.