FluentNHibernate SQL Server 2005/2008 设置教程

发布于 2024-10-08 14:06:55 字数 426 浏览 0 评论 0原文

有谁知道有什么好的教程展示如何为 SQL Server 2005/2008 配置 FluentNhibernate。我发现的通常只使用 SQLite,但我希望看到一个专门针对 SQL Server 2005/2008 的。

我真的很喜欢 FluentNhibernate 网站上的示例教程(http://wiki.fluentnhibernate.org/Getting_started#Your_first_project< /a>),但看起来我发现的大多数教程似乎只涉及 SQLite。很高兴看到一个涉及现实应用程序中更常见数据库(如 SQL Server 2005/2008、MySQL 等)的工作教程 谢谢!

Does anybody know of any good tutorials that show how to configure FluentNhibernate for SQL Server 2005/2008. The ones I have found usually just use SQLite, but I would like to see one that specifically targets SQL Server 2005/2008.

I really liked the sample tutorial on the FluentNhibernate website (http://wiki.fluentnhibernate.org/Getting_started#Your_first_project), but it looks like most tutorials I have found seem to only deal with SQLite. It would be great to see a working tutorial that deals with the more common databases in real world applications like SQL Server 2005/2008, MySQL, etc
Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

如若梦似彩虹 2024-10-15 14:06:55

教程使用 SQLite 并不是因为它“快速且肮脏”,而是因为它是嵌入式的、小型的且免费。任何人都可以下载 System.Data.SQLite 并在大约 60 秒内开始工作,然后切换(或不切换)到另一个数据库影响最小。这是使用 ORM 的主要好处之一。

为了以防万一,我想澄清一下,SQLite 不是一个玩具数据库,对于许多应用程序来说它已经足够甚至是必要的,因为我上面提到的特征对于关系数据库来说并不是太常见。

对于 Fluent-nhibernate,唯一的区别是:

Fluently.Configure()
.Database(
  SQLiteConfiguration.Standard
    .UsingFile("firstProject.db"))...

您将拥有:

Fluently.Configure()
.Database(
  MsSqlConfiguration.MsSql2005
     .ConnectionString("a raw string"))...

每个数据库引擎配置都有其自己特定的可选设置。
有关在 Fluent-nhibernate wiki 中配置不同数据库的更多信息。

Tutorials use SQLite not because it's "quick & dirty" but because it's embedded, small, and free. Anyone can download System.Data.SQLite and start working in about 60 seconds, and later switch (or not) to another database with minimum impact. That's one of the major benefits of using an ORM.

Just in case, I want to clarify that SQLite is not a toy database, for many applications it's enough and even necessary since the characteristics I mentioned above aren't too common for a relational databse.

In the case of fluent-nhibernate, the only difference is that instead of:

Fluently.Configure()
.Database(
  SQLiteConfiguration.Standard
    .UsingFile("firstProject.db"))...

you'll have:

Fluently.Configure()
.Database(
  MsSqlConfiguration.MsSql2005
     .ConnectionString("a raw string"))...

Each database engine config has its own specific optional settings.
More information about configuring different databases in the fluent-nhibernate wiki.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文