|
2 | 2 | using System.Collections;
|
3 | 3 | using System.Collections.Generic;
|
4 | 4 | using System.Data;
|
5 |
| - |
6 | 5 | using NHibernate.AdoNet;
|
7 | 6 | using NHibernate.AdoNet.Util;
|
8 | 7 | using NHibernate.Cache;
|
9 | 8 | using NHibernate.Connection;
|
10 | 9 | using NHibernate.Dialect;
|
11 | 10 | using NHibernate.Exceptions;
|
12 | 11 | using NHibernate.Hql;
|
| 12 | +using NHibernate.Linq; |
13 | 13 | using NHibernate.Linq.Functions;
|
14 | 14 | using NHibernate.Linq.Visitors;
|
15 | 15 | using NHibernate.Transaction;
|
@@ -137,6 +137,8 @@ public Settings BuildSettings(IDictionary<string, string> properties)
|
137 | 137 |
|
138 | 138 | settings.QueryTranslatorFactory = CreateQueryTranslatorFactory(properties);
|
139 | 139 |
|
| 140 | + settings.LinqQueryProviderType = CreateLinqQueryProviderType(properties); |
| 141 | + |
140 | 142 | IDictionary<string, string> querySubstitutions = PropertiesHelper.ToDictionary(Environment.QuerySubstitutions,
|
141 | 143 | " ,=;:\n\t\r\f", properties);
|
142 | 144 | if (log.IsInfoEnabled)
|
@@ -365,6 +367,21 @@ private static IQueryTranslatorFactory CreateQueryTranslatorFactory(IDictionary<
|
365 | 367 | }
|
366 | 368 | }
|
367 | 369 |
|
| 370 | + private static System.Type CreateLinqQueryProviderType(IDictionary<string, string> properties) |
| 371 | + { |
| 372 | + string className = PropertiesHelper.GetString( |
| 373 | + Environment.QueryLinqProvider, properties, typeof(DefaultQueryProvider).FullName); |
| 374 | + log.Info("Query provider: " + className); |
| 375 | + try |
| 376 | + { |
| 377 | + return System.Type.GetType(className, true); |
| 378 | + } |
| 379 | + catch (Exception cnfe) |
| 380 | + { |
| 381 | + throw new HibernateException("could not find query provider class: " + className, cnfe); |
| 382 | + } |
| 383 | + } |
| 384 | + |
368 | 385 | private static ITransactionFactory CreateTransactionFactory(IDictionary<string, string> properties)
|
369 | 386 | {
|
370 | 387 | string className = PropertiesHelper.GetString(
|
|
0 commit comments