mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Fixing OutOfMemory exception when using PrepareSql
The PrepareSql is defined only for Sql Server right now, using a new steps DateServiceProviders to customize nhibernate properties. Work Items: 20563, 20550
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using FluentNHibernate;
|
||||
using FluentNHibernate.Automapping;
|
||||
@@ -48,7 +47,6 @@ namespace Orchard.Data.Providers {
|
||||
.SetProperty(NHibernate.Cfg.Environment.FormatSql, Boolean.FalseString)
|
||||
.SetProperty(NHibernate.Cfg.Environment.GenerateStatistics, Boolean.FalseString)
|
||||
.SetProperty(NHibernate.Cfg.Environment.Hbm2ddlKeyWords, Hbm2DDLKeyWords.None.ToString())
|
||||
.SetProperty(NHibernate.Cfg.Environment.PrepareSql, Boolean.TrueString)
|
||||
.SetProperty(NHibernate.Cfg.Environment.PropertyBytecodeProvider, "lcg")
|
||||
.SetProperty(NHibernate.Cfg.Environment.PropertyUseReflectionOptimizer, Boolean.TrueString)
|
||||
.SetProperty(NHibernate.Cfg.Environment.QueryStartupChecking, Boolean.FalseString)
|
||||
@@ -62,6 +60,10 @@ namespace Orchard.Data.Providers {
|
||||
cfg.EventListeners.PostLoadEventListeners = new IPostLoadEventListener[0];
|
||||
cfg.EventListeners.PreLoadEventListeners = new IPreLoadEventListener[0];
|
||||
|
||||
// don't enable PrepareSql by default as it breaks on SqlCe
|
||||
// this can be done per driver by overriding AlterConfiguration
|
||||
AlterConfiguration(cfg);
|
||||
|
||||
parameters.Configurers.Invoke(c => c.Building(cfg), Logger);
|
||||
|
||||
})
|
||||
@@ -72,6 +74,10 @@ namespace Orchard.Data.Providers {
|
||||
return config.BuildConfiguration();
|
||||
}
|
||||
|
||||
protected virtual void AlterConfiguration(Configuration config) {
|
||||
|
||||
}
|
||||
|
||||
public static AutoPersistenceModel CreatePersistenceModel(ICollection<RecordBlueprint> recordDescriptors) {
|
||||
if(recordDescriptors == null) {
|
||||
throw new ArgumentNullException("recordDescriptors");
|
||||
|
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using FluentNHibernate.Cfg.Db;
|
||||
using NHibernate.Cfg;
|
||||
using NHibernate.SqlAzure;
|
||||
|
||||
namespace Orchard.Data.Providers {
|
||||
@@ -32,5 +33,9 @@ namespace Orchard.Data.Providers {
|
||||
|
||||
return persistence;
|
||||
}
|
||||
|
||||
protected override void AlterConfiguration(Configuration config) {
|
||||
config.SetProperty(NHibernate.Cfg.Environment.PrepareSql, Boolean.TrueString);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user