From 68a2f6dc51d7420dc24d7a6eacaa1a7759894acd Mon Sep 17 00:00:00 2001 From: Renaud Paquay Date: Wed, 5 Jan 2011 16:25:51 -0800 Subject: [PATCH] Invalidate cached configuration when path changes The nhibernate configuration stores the physical path to the SqlCe database so we need to include the physical location as part of the hash key, so that xcopy migrations work as expected. Work Item: 17159 --HG-- branch : 1.x --- src/Orchard/Data/SessionConfigurationCache.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Orchard/Data/SessionConfigurationCache.cs b/src/Orchard/Data/SessionConfigurationCache.cs index 11b744a65..2bc3a3a7c 100644 --- a/src/Orchard/Data/SessionConfigurationCache.cs +++ b/src/Orchard/Data/SessionConfigurationCache.cs @@ -104,12 +104,20 @@ namespace Orchard.Data { private Hash ComputeHash() { var hash = new Hash(); + // Shell settings physical location + // The nhibernate configuration stores the physical path to the SqlCe database + // so we need to include the physical location as part of the hash key, so that + // xcopy migrations work as expected. + var pathName = GetPathName(_shellSettings.Name); + hash.AddString(_appDataFolder.MapPath(pathName).ToLowerInvariant()); + + // Shell settings data hash.AddString(_shellSettings.DataProvider); hash.AddString(_shellSettings.DataTablePrefix); hash.AddString(_shellSettings.DataConnectionString); hash.AddString(_shellSettings.Name); - // We need to hash the assemnly names, record names and property names + // Assembly names, record names and property names foreach (var tableName in _shellBlueprint.Records.Select(x => x.TableName)) { hash.AddString(tableName); }