From 3891e46549dee1ae189bee55a914bbb76e97fa38 Mon Sep 17 00:00:00 2001 From: Shannon Deminick Date: Thu, 18 Apr 2013 20:52:30 +0600 Subject: [PATCH] Fixed a couple threading issues. Improved the performance of the nodeSorter but this should be better improved in 6.x --- src/umbraco.cms/businesslogic/CMSNode.cs | 8 +++++++- src/umbraco.cms/businesslogic/web/Document.cs | 9 +++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/umbraco.cms/businesslogic/CMSNode.cs b/src/umbraco.cms/businesslogic/CMSNode.cs index d325720aa4..9aec9a16b1 100644 --- a/src/umbraco.cms/businesslogic/CMSNode.cs +++ b/src/umbraco.cms/businesslogic/CMSNode.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Data; - +using System.Runtime.CompilerServices; using System.Xml; using umbraco.cms.businesslogic.web; @@ -1036,6 +1036,12 @@ order by level,sortOrder"; } + /// + /// This needs to be synchronized since we are doing multiple sql operations in one method + /// + /// + /// + [MethodImpl(MethodImplOptions.Synchronized)] protected void SavePreviewXml(XmlNode x, Guid versionId) { string sql = PreviewExists(versionId) ? "UPDATE cmsPreviewXml SET xml = @xml, timestamp = @timestamp WHERE nodeId=@nodeId AND versionId = @versionId" diff --git a/src/umbraco.cms/businesslogic/web/Document.cs b/src/umbraco.cms/businesslogic/web/Document.cs index 93275ccdfe..b006f220f1 100644 --- a/src/umbraco.cms/businesslogic/web/Document.cs +++ b/src/umbraco.cms/businesslogic/web/Document.cs @@ -1756,6 +1756,10 @@ where published = 1 And nodeId = @nodeId And trashed = 0", SqlHelper.CreateParam } } + /// + /// This is a specialized method which literally just makes sure that the sortOrder attribute of the xml + /// that is stored in the database is up to date. + /// public void refreshXmlSortOrder() { if (Published) @@ -2002,6 +2006,11 @@ where published = 1 And nodeId = @nodeId And trashed = 0", SqlHelper.CreateParam return temp; } + /// + /// This needs to be synchronized since we're doing multiple sql operations in the single method + /// + /// + [MethodImpl(MethodImplOptions.Synchronized)] private void saveXml(XmlNode x) { bool exists = (SqlHelper.ExecuteScalar("SELECT COUNT(nodeId) FROM cmsContentXml WHERE nodeId=@nodeId",