对 SQL Server 2008 R2 的 FluentNhibernate 支持 [英] FluentNhibernate support for SQL Server 2008 R2

查看:16
本文介绍了对 SQL Server 2008 R2 的 FluentNhibernate 支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用 SQL Server 2008 R2 实现一个 Fluent Nhibernate 应用程序.

I want to implement a Fluent Nhibernate application with SQL Server 2008 R2.

我对 Fluent Nhibernate 1.2 是否支持 SQL Server 2008 R2 感到困惑.

I am in a confusion whether Fluent Nhibernate 1.2 supports SQL Server 2008 R2.

如果支持将是什么配置.是不是像下面这样?

If supports what will be the configuration. Does it looks like below?

var config = Fluently.Configure()
                .Database(
                    MsSqlConfiguration
                    .MsSql2008R2
                    .ConnectionString(@"Data Source=.SQLEXPRESS;AttachDbFilename='FNHLD.mdf';Integrated Security=True;User Instance=True"))
                    .Mappings(m => m.FluentMappings.AddFromAssemblyOf<NHibernateRepository<T>>())
                .BuildConfiguration();

推荐答案

事实上,即使是 MsSql2005 方言也可以在 SQL Server 2008 R2 上运行.

As a matter of fact, even MsSql2005 dialect will work on SQL Server 2008 R2.

即,如果您在 SQL Server 2008 数据库上使用 MsSql2005 方言,NHibernate 将无法使用 SQL Server 2008 新增的一些关于日期/时间的其他类型.

Ie, if you use MsSql2005 dialect on SQL Server 2008 database, NHibernate only won't be able to use some additional types regarding date/times that are new to SQL Server 2008.

只是为了好玩,这里是2000-2012 SQL Server方言源代码的链接:

Just for fun, here are the links to the source code of 2000-2012 SQL Server dialects:

MsSql2000
MsSql2005
MsSql2008
MsSql2012

你可以在那里看到模式.MsSql2000 是一种主要的方言.MsSql2005 继承自 MsSql2005 并有几个覆盖.MsSql2008 继承自 MsSql2005,也很少有覆盖.MsSql2012 继承自 MsSql2008.

You can see the pattern there. MsSql2000 is kind of a main dialect. MsSql2005 inherits from MsSql2005 and has a couple of overrides. MsSql2008 inherits from MsSql2005, also with few overrides. MsSql2012 inherits from MsSql2008.

SQL Server R2 有点像服务包.数据库引擎本身没有太大变化,因此不需要单独的方言.使用 2005 年或 2008 年的方言就可以了.

SQL Server R2 is kind of like a service pack. Not much has changed in the database engine itself, so there wasn't a need to have a separate dialect. Use either 2005 or 2008 dialect and you will be fine.

这篇关于对 SQL Server 2008 R2 的 FluentNhibernate 支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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