diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml
index 173da6cc9b..f68359b0af 100644
--- a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml
+++ b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml
@@ -1142,7 +1142,7 @@ To manage your website, simply open the Umbraco back office and start adding con
Building models
-
this can take abit of time, don't worry
+
this can take a bit of time, don't worry
Models generated
Models could not be generated
Models generation has failed, see exception in U log
diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml b/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml
index 255bf62d5d..c6f94949d2 100644
--- a/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml
+++ b/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml
@@ -27,6 +27,9 @@
Опубликовать
Обновить узлы
Опубликовать весь сайт
+
Установить разрешения для страницы '%0%'
+
Выберите, куда переместить
+
В структуре документов ниже
Восстановить
Разрешения
Откатить
@@ -189,7 +192,7 @@
Роль участника
Тип участника
Дата не указана
-
Заголовок страницы
+
Заголовок ссылки
Не является членом групп(ы)
Свойства
Этот документ опубликован, но скрыт, потому что его родительский документ '%0%' не опубликован
@@ -341,9 +344,10 @@
Просмотр элемента кэша
Создать папку...
Связать с оригиналом
+
Включая все дочерние
Самое дружелюбное сообщество
Ссылка на страницу
-
Открывает документ по ссылке в новом окне или вкладке браузера
+
Открывать ссылку в новом окне или вкладке браузера
Ссылка на медиа-файл
Выбрать медиа
Выбрать значок
diff --git a/src/Umbraco.Web/Cache/ContentTypeCacheRefresher.cs b/src/Umbraco.Web/Cache/ContentTypeCacheRefresher.cs
index 246571d479..1340545621 100644
--- a/src/Umbraco.Web/Cache/ContentTypeCacheRefresher.cs
+++ b/src/Umbraco.Web/Cache/ContentTypeCacheRefresher.cs
@@ -131,9 +131,7 @@ namespace Umbraco.Web.Cache
ClearAllIsolatedCacheByEntityType
();
ClearAllIsolatedCacheByEntityType();
ClearAllIsolatedCacheByEntityType();
-
- //all property type cache
- ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(CacheKeys.PropertyTypeCacheKey);
+
//all content type property cache
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(CacheKeys.ContentTypePropertiesCacheKey);
//all content type cache
@@ -266,12 +264,6 @@ namespace Umbraco.Web.Cache
///
private static void ClearContentTypeCache(JsonPayload payload)
{
- //clears the cache for each property type associated with the content type
- foreach (var pid in payload.PropertyTypeIds)
- {
- ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem(CacheKeys.PropertyTypeCacheKey + pid);
- }
-
//clears the cache associated with the Content type itself
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem(string.Format("{0}{1}", CacheKeys.ContentTypeCacheKey, payload.Id));
//clears the cache associated with the content type properties collection
diff --git a/src/Umbraco.Web/ImageCropperTemplateExtensions.cs b/src/Umbraco.Web/ImageCropperTemplateExtensions.cs
index e518c5e246..63157e4fee 100644
--- a/src/Umbraco.Web/ImageCropperTemplateExtensions.cs
+++ b/src/Umbraco.Web/ImageCropperTemplateExtensions.cs
@@ -81,7 +81,7 @@ namespace Umbraco.Web
/// Use focal point, to generate an output image using the focal point instead of the predefined crop
///
///
- /// Use crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters>.
+ /// Use crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters.
///
///
/// Add a serialised date of the last edit of the item to ensure client cache refresh when updated
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControl.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControl.cs
index 5a8b0b616e..c912db701d 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControl.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControl.cs
@@ -2,6 +2,7 @@ using System;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Collections;
+using System.ComponentModel;
using System.IO;
using Umbraco.Core.IO;
using System.Linq;
@@ -11,6 +12,8 @@ namespace umbraco.controls
///
/// Summary description for ContentTypeControl.
///
+ [Obsolete("No longer used, will be removed in v8")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
public class ContentTypeControl : uicontrols.TabView
{
public event System.EventHandler OnSave;
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs
index 9734401d95..91a8677c81 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs
@@ -3,6 +3,7 @@ using System.Collections;
using System.Configuration.Provider;
using System.Globalization;
using System.IO;
+using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
@@ -320,13 +321,14 @@ namespace umbraco.cms.presentation.user
}
// Populate dropdowns
- foreach (DocumentType dt in DocumentType.GetAllAsList())
- cDocumentType.Items.Add(
- new ListItem(dt.Text, dt.Alias)
- );
+ var allContentTypes = Services.ContentTypeService.GetAllContentTypes().ToList();
+ foreach (var dt in allContentTypes)
+ {
+ cDocumentType.Items.Add(new ListItem(dt.Name, dt.Alias));
+ }
// populate fields
- ArrayList fields = new ArrayList();
+ var fields = new ArrayList();
cDescription.ID = "cDescription";
cCategories.ID = "cCategories";
cExcerpt.ID = "cExcerpt";
@@ -334,9 +336,9 @@ namespace umbraco.cms.presentation.user
cCategories.Items.Add(new ListItem(ui.Text("choose"), ""));
cExcerpt.Items.Add(new ListItem(ui.Text("choose"), ""));
- foreach (PropertyType pt in PropertyType.GetAll())
+ foreach (var pt in allContentTypes.SelectMany(x => x.PropertyTypes).OrderBy(x => x.Name))
{
- if (!fields.Contains(pt.Alias))
+ if (fields.Contains(pt.Alias) == false)
{
cDescription.Items.Add(new ListItem(string.Format("{0} ({1})", pt.Name, pt.Alias), pt.Alias));
cCategories.Items.Add(new ListItem(string.Format("{0} ({1})", pt.Name, pt.Alias), pt.Alias));
diff --git a/src/UmbracoExamine/BaseUmbracoIndexer.cs b/src/UmbracoExamine/BaseUmbracoIndexer.cs
index d05a47099d..74b3ff676d 100644
--- a/src/UmbracoExamine/BaseUmbracoIndexer.cs
+++ b/src/UmbracoExamine/BaseUmbracoIndexer.cs
@@ -101,7 +101,7 @@ namespace UmbracoExamine
/// Determines if the manager will call the indexing methods when content is saved or deleted as
/// opposed to cache being updated.
///
- public bool SupportUnpublishedContent { get; protected set; }
+ public bool SupportUnpublishedContent { get; protected internal set; }
///
/// The data service used for retreiving and submitting data to the cms
diff --git a/src/UmbracoExamine/UmbracoContentIndexer.cs b/src/UmbracoExamine/UmbracoContentIndexer.cs
index efc3e4a214..447fd62f4c 100644
--- a/src/UmbracoExamine/UmbracoContentIndexer.cs
+++ b/src/UmbracoExamine/UmbracoContentIndexer.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
+using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Xml.Linq;
@@ -359,18 +360,17 @@ namespace UmbracoExamine
}
#endregion
- #region Protected
-
- ///
- /// This is a static query, it's parameters don't change so store statically
- ///
- private IQuery _publishedQuery;
+ #region Protected
protected override void PerformIndexAll(string type)
{
const int pageSize = 10000;
var pageIndex = 0;
+ DataService.LogService.AddInfoLog(-1, string.Format("PerformIndexAll - Start data queries - {0}", type));
+ var stopwatch = new Stopwatch();
+ stopwatch.Start();
+
switch (type)
{
case IndexTypes.Content:
@@ -395,11 +395,6 @@ namespace UmbracoExamine
}
else
{
- if (_publishedQuery == null)
- {
- _publishedQuery = Query.Builder.Where(x => x.Published == true);
- }
-
//get all paged records but order by level ascending, we need to do this because we need to track which nodes are not published so that we can determine
// which descendent nodes are implicitly not published
descendants = _contentService.GetPagedDescendants(contentParentId, pageIndex, pageSize, out total, "level", Direction.Ascending, true, (string)null);
@@ -415,7 +410,12 @@ namespace UmbracoExamine
{
content = descendants.ToArray();
}
- AddNodesToIndex(GetSerializedContent(content, notPublished).WhereNotNull(), type);
+
+ AddNodesToIndex(GetSerializedContent(
+ SupportUnpublishedContent,
+ c => _serializer.Serialize(_contentService, _dataTypeService, _userService, c),
+ content, notPublished).WhereNotNull(), type);
+
pageIndex++;
} while (content.Length == pageSize);
@@ -471,19 +471,27 @@ namespace UmbracoExamine
break;
}
+
+ stopwatch.Stop();
+ DataService.LogService.AddInfoLog(-1, string.Format("PerformIndexAll - End data queries - {0}, took {1}ms", type, stopwatch.ElapsedMilliseconds));
}
- private IEnumerable GetSerializedContent(IEnumerable content, ISet notPublished)
+ internal static IEnumerable GetSerializedContent(
+ bool supportUnpublishdContent,
+ Func serializer,
+ IEnumerable content,
+ ISet notPublished)
{
foreach (var c in content)
{
- if (SupportUnpublishedContent == false)
+ if (supportUnpublishdContent == false)
{
//if we don't support published content and this is not published then track it and return null
if (c.Published == false)
{
notPublished.Add(c.Path);
yield return null;
+ continue;
}
//if we don't support published content, check if this content item exists underneath any already tracked
@@ -491,14 +499,11 @@ namespace UmbracoExamine
if (notPublished.Any(path => c.Path.StartsWith(string.Format("{0},", path))))
{
yield return null;
+ continue;
}
- }
+ }
- var xml = _serializer.Serialize(
- _contentService,
- _dataTypeService,
- _userService,
- c);
+ var xml = serializer(c);
//add a custom 'icon' attribute
xml.Add(new XAttribute("icon", c.ContentType.Icon));
@@ -520,7 +525,7 @@ namespace UmbracoExamine
public override void RebuildIndex()
{
- DataService.LogService.AddVerboseLog(-1, "Rebuilding index");
+ DataService.LogService.AddInfoLog(-1, "Rebuilding index");
base.RebuildIndex();
}
diff --git a/src/UmbracoExamine/UmbracoMemberIndexer.cs b/src/UmbracoExamine/UmbracoMemberIndexer.cs
index 64a574822f..e3833da317 100644
--- a/src/UmbracoExamine/UmbracoMemberIndexer.cs
+++ b/src/UmbracoExamine/UmbracoMemberIndexer.cs
@@ -9,6 +9,7 @@ using Umbraco.Core.Persistence.DatabaseModelDefinitions;
using Umbraco.Core.Services;
using UmbracoExamine.Config;
using System.Collections.Generic;
+using System.Diagnostics;
using Examine;
using System.IO;
using UmbracoExamine.DataServices;
@@ -132,6 +133,10 @@ namespace UmbracoExamine
const int pageSize = 1000;
var pageIndex = 0;
+ DataService.LogService.AddInfoLog(-1, string.Format("PerformIndexAll - Start data queries - {0}", type));
+ var stopwatch = new Stopwatch();
+ stopwatch.Start();
+
IMember[] members;
if (IndexerData.IncludeNodeTypes.Any())
@@ -163,6 +168,9 @@ namespace UmbracoExamine
pageIndex++;
} while (members.Length == pageSize);
}
+
+ stopwatch.Stop();
+ DataService.LogService.AddInfoLog(-1, string.Format("PerformIndexAll - End data queries - {0}, took {1}ms", type, stopwatch.ElapsedMilliseconds));
}
private IEnumerable GetSerializedMembers(IEnumerable members)
diff --git a/src/umbraco.cms/businesslogic/Tags/Tag.cs b/src/umbraco.cms/businesslogic/Tags/Tag.cs
index 8534d02d26..d4e0c90d00 100644
--- a/src/umbraco.cms/businesslogic/Tags/Tag.cs
+++ b/src/umbraco.cms/businesslogic/Tags/Tag.cs
@@ -351,7 +351,7 @@ namespace umbraco.cms.businesslogic.Tags
{
Document cnode = new Document(rr.GetInt("nodeid"));
- if (cnode != null && cnode.Published)
+ if (cnode.Published)
docs.Add(cnode);
}
}
diff --git a/src/umbraco.cms/businesslogic/propertytype/propertytype.cs b/src/umbraco.cms/businesslogic/propertytype/propertytype.cs
index b9622d7c91..e041306ba3 100644
--- a/src/umbraco.cms/businesslogic/propertytype/propertytype.cs
+++ b/src/umbraco.cms/businesslogic/propertytype/propertytype.cs
@@ -54,32 +54,31 @@ namespace umbraco.cms.businesslogic.propertytype
public PropertyType(int id)
{
- using (var sqlHelper = Application.SqlHelper)
- using (IRecordsReader dr = sqlHelper.ExecuteReader(
- "Select mandatory, DataTypeId, propertyTypeGroupId, ContentTypeId, sortOrder, alias, name, validationRegExp, description from cmsPropertyType where id=@id",
- sqlHelper.CreateParameter("@id", id)))
+ var found = ApplicationContext.Current.DatabaseContext.Database
+ .SingleOrDefault(
+ "Select mandatory, DataTypeId, propertyTypeGroupId, contentTypeId, sortOrder, alias, name, validationRegExp, description from cmsPropertyType where id=@id",
+ new {id = id});
+
+ if (found == null)
+ throw new ArgumentException("Propertytype with id: " + id + " doesnt exist!");
+
+ _mandatory = found.mandatory;
+ _id = id;
+
+ if (found.propertyTypeGroupId != null)
{
- if (!dr.Read())
- throw new ArgumentException("Propertytype with id: " + id + " doesnt exist!");
-
- _mandatory = dr.GetBoolean("mandatory");
- _id = id;
-
- if (!dr.IsNull("propertyTypeGroupId"))
- {
- _propertyTypeGroup = dr.GetInt("propertyTypeGroupId");
- //TODO: Remove after refactoring!
- _tabId = _propertyTypeGroup;
- }
-
- _sortOrder = dr.GetInt("sortOrder");
- _alias = dr.GetString("alias");
- _name = dr.GetString("Name");
- _validationRegExp = dr.GetString("validationRegExp");
- _DataTypeId = dr.GetInt("DataTypeId");
- _contenttypeid = dr.GetInt("contentTypeId");
- _description = dr.GetString("description");
+ _propertyTypeGroup = found.propertyTypeGroupId;
+ //TODO: Remove after refactoring!
+ _tabId = _propertyTypeGroup;
}
+
+ _sortOrder = found.sortOrder;
+ _alias = found.alias;
+ _name = found.name;
+ _validationRegExp = found.validationRegExp;
+ _DataTypeId = found.DataTypeId;
+ _contenttypeid = found.contentTypeId;
+ _description = found.description;
}
#endregion
@@ -92,7 +91,6 @@ namespace umbraco.cms.businesslogic.propertytype
set
{
_DataTypeId = value.Id;
- InvalidateCache();
using (var sqlHelper = Application.SqlHelper)
sqlHelper.ExecuteNonQuery(
"Update cmsPropertyType set DataTypeId = " + value.Id + " where id=" + Id);
@@ -119,7 +117,6 @@ namespace umbraco.cms.businesslogic.propertytype
{
_tabId = value;
PropertyTypeGroup = value;
- InvalidateCache();
}
}
@@ -148,7 +145,6 @@ namespace umbraco.cms.businesslogic.propertytype
set
{
_mandatory = value;
- InvalidateCache();
using (var sqlHelper = Application.SqlHelper)
sqlHelper.ExecuteNonQuery("Update cmsPropertyType set mandatory = @mandatory where id = @id",
sqlHelper.CreateParameter("@mandatory", value),
@@ -162,7 +158,6 @@ namespace umbraco.cms.businesslogic.propertytype
set
{
_validationRegExp = value;
- InvalidateCache();
using (var sqlHelper = Application.SqlHelper)
sqlHelper.ExecuteNonQuery("Update cmsPropertyType set validationRegExp = @validationRegExp where id = @id",
sqlHelper.CreateParameter("@validationRegExp", value), sqlHelper.CreateParameter("@id", Id));
@@ -199,7 +194,6 @@ namespace umbraco.cms.businesslogic.propertytype
set
{
_description = value;
- InvalidateCache();
using (var sqlHelper = Application.SqlHelper)
sqlHelper.ExecuteNonQuery("Update cmsPropertyType set description = @description where id = @id",
sqlHelper.CreateParameter("@description", value),
@@ -213,7 +207,6 @@ namespace umbraco.cms.businesslogic.propertytype
set
{
_sortOrder = value;
- InvalidateCache();
using (var sqlHelper = Application.SqlHelper)
sqlHelper.ExecuteNonQuery("Update cmsPropertyType set sortOrder = @sortOrder where id = @id",
sqlHelper.CreateParameter("@sortOrder", value),
@@ -227,7 +220,6 @@ namespace umbraco.cms.businesslogic.propertytype
set
{
_alias = value;
- InvalidateCache();
using (var sqlHelper = Application.SqlHelper)
sqlHelper.ExecuteNonQuery("Update cmsPropertyType set alias = @alias where id= @id",
sqlHelper.CreateParameter("@alias", Casing.SafeAliasWithForcingCheck(_alias)),
@@ -264,7 +256,6 @@ namespace umbraco.cms.businesslogic.propertytype
set
{
_name = value;
- InvalidateCache();
using (var sqlHelper = Application.SqlHelper)
sqlHelper.ExecuteNonQuery(
"UPDATE cmsPropertyType SET name=@name WHERE id=@id",
@@ -331,17 +322,17 @@ namespace umbraco.cms.businesslogic.propertytype
public static IEnumerable GetPropertyTypes()
{
var result = new List();
- using (var sqlHelper = Application.SqlHelper)
- using (IRecordsReader dr =
- sqlHelper.ExecuteReader("select id from cmsPropertyType order by Name"))
+
+ var propertyTypeIds = ApplicationContext.Current.DatabaseContext.Database.Fetch(
+ "select id from cmsPropertyType order by Name");
+
+ foreach (var propertyTypeId in propertyTypeIds)
{
- while (dr.Read())
- {
- PropertyType pt = GetPropertyType(dr.GetInt("id"));
- if (pt != null)
- result.Add(pt);
- }
+ PropertyType pt = GetPropertyType(propertyTypeId);
+ if (pt != null)
+ result.Add(pt);
}
+
return result;
}
@@ -353,18 +344,17 @@ namespace umbraco.cms.businesslogic.propertytype
public static IEnumerable GetPropertyTypesByGroup(int groupId)
{
var result = new List();
- using (var sqlHelper = Application.SqlHelper)
- using (IRecordsReader dr =
- sqlHelper.ExecuteReader("SELECT id FROM cmsPropertyType WHERE propertyTypeGroupId = @groupId order by SortOrder",
- sqlHelper.CreateParameter("@groupId", groupId)))
+
+ var propertyTypeIds = ApplicationContext.Current.DatabaseContext.Database.Fetch(
+ "SELECT id FROM cmsPropertyType WHERE propertyTypeGroupId = @groupId order by SortOrder", new {groupId = groupId});
+
+ foreach (var propertyTypeId in propertyTypeIds)
{
- while (dr.Read())
- {
- PropertyType pt = GetPropertyType(dr.GetInt("id"));
- if (pt != null)
- result.Add(pt);
- }
+ PropertyType pt = GetPropertyType(propertyTypeId);
+ if (pt != null)
+ result.Add(pt);
}
+
return result;
}
@@ -376,20 +366,18 @@ namespace umbraco.cms.businesslogic.propertytype
public static IEnumerable GetByDataTypeDefinition(int dataTypeDefId)
{
var result = new List();
- using (var sqlHelper = Application.SqlHelper)
- using (IRecordsReader dr =
- sqlHelper.ExecuteReader(
- "select id, Name from cmsPropertyType where dataTypeId=@dataTypeId order by Name",
- sqlHelper.CreateParameter("@dataTypeId", dataTypeDefId)))
+
+ var propertyTypeIds = ApplicationContext.Current.DatabaseContext.Database.Fetch(
+ "select id from cmsPropertyType where dataTypeId=@dataTypeId order by Name", new {dataTypeId = dataTypeDefId});
+
+ foreach (var propertyTypeId in propertyTypeIds)
{
- while (dr.Read())
- {
- PropertyType pt = GetPropertyType(dr.GetInt("id"));
- if (pt != null)
- result.Add(pt);
- }
+ PropertyType pt = GetPropertyType(propertyTypeId);
+ if (pt != null)
+ result.Add(pt);
}
- return result.ToList();
+
+ return result;
}
public void delete()
@@ -411,7 +399,6 @@ namespace umbraco.cms.businesslogic.propertytype
// delete cache from either master (via tabid) or current contentype
FlushCacheBasedOnTab();
- InvalidateCache();
}
public void FlushCacheBasedOnTab()
@@ -478,8 +465,6 @@ namespace umbraco.cms.businesslogic.propertytype
protected virtual void FlushCache()
{
- // clear local cache
- ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem(GetCacheKey(Id));
// clear cache in contentype
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem(CacheKeys.ContentTypePropertiesCacheKey + _contenttypeid);
@@ -496,31 +481,9 @@ namespace umbraco.cms.businesslogic.propertytype
public static PropertyType GetPropertyType(int id)
{
- return ApplicationContext.Current.ApplicationCache.RuntimeCache.GetCacheItem(
- GetCacheKey(id),
- timeout: TimeSpan.FromMinutes(30),
- getCacheItem: () =>
- {
- try
- {
- return new PropertyType(id);
- }
- catch
- {
- return null;
- }
- });
- }
-
- private void InvalidateCache()
- {
- ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem(GetCacheKey(Id));
- }
-
- private static string GetCacheKey(int id)
- {
- return CacheKeys.PropertyTypeCacheKey + id;
+ return new PropertyType(id);
}
+
#endregion
}
diff --git a/src/umbraco.cms/businesslogic/web/Document.cs b/src/umbraco.cms/businesslogic/web/Document.cs
index 70775f5c71..bd21517d80 100644
--- a/src/umbraco.cms/businesslogic/web/Document.cs
+++ b/src/umbraco.cms/businesslogic/web/Document.cs
@@ -433,21 +433,20 @@ namespace umbraco.cms.businesslogic.web
{
XmlDocument xd = new XmlDocument();
- using (var sqlHelper = Application.SqlHelper)
- using (IRecordsReader dr = sqlHelper.ExecuteReader("select nodeId from cmsDocument"))
+ var nodeIds = ApplicationContext.Current.DatabaseContext.Database.Fetch(
+ "select nodeId from cmsDocument");
+
+ foreach (var nodeId in nodeIds)
{
- while (dr.Read())
+ try
{
- try
- {
- new Document(dr.GetInt("nodeId")).SaveXmlPreview(xd);
- }
- catch (Exception ee)
- {
- LogHelper.Error("Error generating preview xml", ee);
- }
+ new Document(nodeId).SaveXmlPreview(xd);
}
- }
+ catch (Exception ee)
+ {
+ LogHelper.Error("Error generating preview xml", ee);
+ }
+ }
}
///
diff --git a/src/umbraco.editorControls/PickerRelations/PickerRelationsEventHandler.cs b/src/umbraco.editorControls/PickerRelations/PickerRelationsEventHandler.cs
index 13f786359b..844d9920e0 100644
--- a/src/umbraco.editorControls/PickerRelations/PickerRelationsEventHandler.cs
+++ b/src/umbraco.editorControls/PickerRelations/PickerRelationsEventHandler.cs
@@ -2,8 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
-
-using umbraco.BusinessLogic; // ApplicationBase
+// ApplicationBase
using umbraco.businesslogic;
using umbraco.cms.businesslogic; // SaveEventArgs
using umbraco.cms.businesslogic.media; // Media
@@ -12,6 +11,8 @@ using umbraco.cms.businesslogic.web; // Documentusing umbraco.cms.businesslogic.
using umbraco.cms.businesslogic.property;
using umbraco.cms.businesslogic.relation;
using umbraco.DataLayer;
+using Umbraco.Core;
+using Application = umbraco.BusinessLogic.Application;
namespace umbraco.editorControls.PickerRelations
{
@@ -212,7 +213,7 @@ namespace umbraco.editorControls.PickerRelations
private static void DeleteRelations(RelationType relationType, int contentNodeId, bool reverseIndexing, string instanceIdentifier)
{
//if relationType is bi-directional or a reverse index then we can't get at the relations via the API, so using SQL
- string getRelationsSql = "SELECT id FROM umbracoRelation WHERE relType = " + relationType.Id.ToString() + " AND ";
+ string getRelationsSql = "SELECT id FROM umbracoRelation WHERE relType = " + relationType.Id + " AND ";
if (reverseIndexing || relationType.Dual)
{
@@ -229,19 +230,16 @@ namespace umbraco.editorControls.PickerRelations
getRelationsSql += " AND comment = '" + instanceIdentifier + "'";
- using (var sqlHelper = Application.SqlHelper)
- using (IRecordsReader relations = sqlHelper.ExecuteReader(getRelationsSql))
- {
- //clear data
- Relation relation;
- while (relations.Read())
- {
- relation = new Relation(relations.GetInt("id"));
+ var relationIds = ApplicationContext.Current.DatabaseContext.Database.Fetch(
+ getRelationsSql);
+ foreach (var relationId in relationIds)
+ {
+ var relation = new Relation(relationId);
- // TODO: [HR] check to see if an instance identifier is used
- relation.Delete();
- }
- }
+ // TODO: [HR] check to see if an instance identifier is used
+ relation.Delete();
+ }
+
}
///