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

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

问题描述

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



我很困惑Fluent Nhibernate 1.2是否支持SQL Server 2008 R2。 >

如果支持什么配置。它看起来像下面吗?
$ b $ pre $ code $ 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上。也就是说,如果你在SQL Server 2008数据库上使用MsSql2005方言,NHibernate将只能使用SQL Server新增的日期/时间的一些附加类型为了好玩,下面是2000-2012 SQL Server方言源代码的链接:




MsSql2000



MsSql2008 >
MsSql2012



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



SQL Server R2就像一个服务包。数据库引擎本身没有多少变化,所以不需要单独的方言。使用2005年或2008年方言,你会没事的。


I want to implement a Fluent Nhibernate application with 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();

解决方案

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

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.

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

MsSql2000
MsSql2005
MsSql2008
MsSql2012

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 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.

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

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