Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NHibernate Driver and Sql Dialect for SQL Server 2014

We have an application which is running on NHibernate.3.3.3.4001.

We have decided to upgrade from SQL Server 2008 R2 to SQL Server 2014.

Previously, we had the following the fluent configuration :

var databaseConfiguration = MsSqlConfiguration.MsSql2008.ConnectionString(connectionString)
            .Dialect<MsSql2008Dialect>();

databaseConfiguration = databaseConfiguration.Driver<Sql2008ClientDriver>();

I have tested that the application works fine with this configuration when I connect to an instance of a SQL Server 2014 database.

  1. How is it possible that I can use the 2008 driver and dialect while connecting to a 2014 database?

  2. Is there any complication that may arise in the future that I am overlooking?

  3. Is there support for 2014 driver and dialect in a higher version of NHibernate?

like image 361
bala_88 Avatar asked Jan 12 '15 14:01

bala_88


1 Answers

The following features depend on the dialect used.

  • Paging, instead of using the native SKIP/TAKE-Feature that MSSQL 2012 and upwards has, paging is emulatd by a subquery that generates numbers for all returned rows. This is a fallback that does not perform the way the native feature does.
  • Sequences, MSSQL 2012 and upwards now has the same feature that Oracle has. You can create a named sequence that generates incrementing numbers. This is used by the "Enhanced" Generators of NHibernate to generate a PK for inserted rows.

Question #1: As MSSQL 2008 has less features and MSSQL 2012 only adds new features the older driver can be used.

Question #2: You loose some optmizations that I described above.

Question #3: NHibernate 4.0 adds MSSQL 2012, currently no dialect for MSSQL 2014 exists. This is definitely not a big issue as many of the MSSQL 2014 Features are irrelevant/transparent for the OR-Mapper.

like image 75
hessenmob82 Avatar answered Nov 14 '22 16:11

hessenmob82