Reputation: 280
I've just installed the following latest packages from NuGet:
FluentNHibernate.1.3.0.733 NHibernate.3.3.2.4000 (was required for FNH)
I'm trying to get our ASP.NET MVC 3 app running using SQL 2012 (native).
The following code is taken from our method which builds our nhibernate Session:
var sqlConfig = MsSqlConfiguration.MsSql2005.ConnectionString(ConnectionString).AdoNetBatchSize(30);
We also use this approach for provisioning a new emtpy DB using the code first approach.
I need to use the SQL 2012 dialiect but neither the latest FNH or NHibernate have it from NuGet.
Does anyone kow the status of the code in Git for these? I can see a merge for FNH for this 2012 dialiect was done 7 months ago (a month after the latest NuGet was released).
What are others doing to connect to SQL 2012?
Does anyone know when the next NuGet packagaes for these will be available?
Upvotes: 1
Views: 1801
Reputation: 16938
My current setup is using NHibernate (3.3.2.4000) and FluentNHibernate (1.3.0.733) and the first part of my connection setup looks like this, feel free to adapt it to your needs. Note that even though I pull the connection string using the MsSql2008
configuration class, I have set my dialect to MsSql2012Dialect
var cfg = Fluent.NHibernate.Cfg.Fluently.Configure()
.Database(FluentNHibernate.Cfg.Db.MsSqlConfiguration.MsSql2008
.ConnectionString(c => c.FromConnectionStringWithKey("KeyName"))
#if DEBUG
.ShowSql()
.FormatSql()
#endif
.Dialect<NHibernate.Dialect.MsSql2012Dialect>()
.AdoNetBatchSize(50)
)
//Other chained methods (for setting up cache, mappings, etc)
//.Mappings(m =>
//{
//
//}
var sessionFactory = cfg.BuildSessionFactory();
from what I can see the 2012 Dialect just adds support for Sequences
and registers iif
as a function.
Upvotes: 0
Reputation: 52745
It's already supported by the NHibernate core, so it's just a matter of using MsSql2012Dialect
:
var sqlConfig = MsSqlConfiguration.MsSql2005.Dialect<MsSql2012Dialect>();
MsSqlConfiguration.MsSql2012
was added to Fluent shortly after the latest release, so you can grab the source if you want, but the end result is the same.
Upvotes: 3
Reputation: 49291
Just use the SQL Server 2008 dialect. I don't know of any changes in 2012 that would require an update to the dialect.
Upvotes: 3