diff --git a/src/Umbraco.Core/Constants-System.cs b/src/Umbraco.Core/Constants-System.cs
index b38417c39b..d4deda826e 100644
--- a/src/Umbraco.Core/Constants-System.cs
+++ b/src/Umbraco.Core/Constants-System.cs
@@ -11,17 +11,53 @@
/// The integer identifier for global system root node.
///
public const int Root = -1;
+
+ ///
+ /// The string identifier for global system root node.
+ ///
+ /// Use this instead of re-creating the string everywhere.
+ public const string RootString = "-1";
///
/// The integer identifier for content's recycle bin.
///
public const int RecycleBinContent = -20;
+
+ ///
+ /// The string identifier for content's recycle bin.
+ ///
+ /// Use this instead of re-creating the string everywhere.
+ public const string RecycleBinContentString = "-20";
+
+ ///
+ /// The string path prefix of the content's recycle bin.
+ ///
+ ///
+ /// Everything that is in the content recycle bin, has a path that starts with the prefix.
+ /// Use this instead of re-creating the string everywhere.
+ ///
+ public const string RecycleBinContentPathPrefix = "-1,-20,";
///
/// The integer identifier for media's recycle bin.
///
public const int RecycleBinMedia = -21;
+ ///
+ /// The string identifier for media's recycle bin.
+ ///
+ /// Use this instead of re-creating the string everywhere.
+ public const string RecycleBinMediaString = "-21";
+
+ ///
+ /// The string path prefix of the media's recycle bin.
+ ///
+ ///
+ /// Everything that is in the media recycle bin, has a path that starts with the prefix.
+ /// Use this instead of re-creating the string everywhere.
+ ///
+ public const string RecycleBinMediaPathPrefix = "-1,-21,";
+
public const int DefaultContentListViewDataTypeId = -95;
public const int DefaultMediaListViewDataTypeId = -96;
public const int DefaultMembersListViewDataTypeId = -97;
@@ -29,6 +65,6 @@
public const string UmbracoConnectionName = "umbracoDbDSN";
public const string UmbracoMigrationName = "Umbraco";
}
-
+
}
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Services/ContentService.cs b/src/Umbraco.Core/Services/ContentService.cs
index bcf520d1f7..3cbfd77045 100644
--- a/src/Umbraco.Core/Services/ContentService.cs
+++ b/src/Umbraco.Core/Services/ContentService.cs
@@ -912,7 +912,7 @@ namespace Umbraco.Core.Services
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
{
var repository = RepositoryFactory.CreateContentRepository(uow);
- var query = Query.Builder.Where(x => x.Path.StartsWith(Constants.System.RecycleBinContent.ToInvariantString()));
+ var query = Query.Builder.Where(x => x.Path.StartsWith(Constants.System.RecycleBinContentPathPrefix));
return repository.GetByQuery(query);
}
}
diff --git a/src/Umbraco.Core/Services/MediaService.cs b/src/Umbraco.Core/Services/MediaService.cs
index 8579281b85..398cf9f1b0 100644
--- a/src/Umbraco.Core/Services/MediaService.cs
+++ b/src/Umbraco.Core/Services/MediaService.cs
@@ -389,7 +389,7 @@ namespace Umbraco.Core.Services
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
{
var repository = RepositoryFactory.CreateMediaRepository(uow);
- var query = Query.Builder.Where(x => x.Level == level && x.Path.StartsWith(Constants.System.RecycleBinMedia.ToString()) == false);
+ var query = Query.Builder.Where(x => x.Level == level && x.Path.StartsWith(Constants.System.RecycleBinMediaPathPrefix) == false);
return repository.GetByQuery(query);
}
}
@@ -440,7 +440,7 @@ namespace Umbraco.Core.Services
/// An Enumerable list of objects
public IEnumerable GetAncestors(IMedia media)
{
- var ids = media.Path.Split(',').Where(x => x != Constants.System.Root.ToString() && x != media.Id.ToString(CultureInfo.InvariantCulture)).Select(int.Parse).ToArray();
+ var ids = media.Path.Split(',').Where(x => x != Constants.System.RootString && x != media.Id.ToString(CultureInfo.InvariantCulture)).Select(int.Parse).ToArray();
if (ids.Any() == false)
return new List();
@@ -717,7 +717,7 @@ namespace Umbraco.Core.Services
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
{
var repository = RepositoryFactory.CreateMediaRepository(uow);
- var query = Query.Builder.Where(x => x.Path.StartsWith(Constants.System.RecycleBinMedia.ToString()));
+ var query = Query.Builder.Where(x => x.Path.StartsWith(Constants.System.RecycleBinMediaPathPrefix));
return repository.GetByQuery(query);
}
}
@@ -868,7 +868,7 @@ namespace Umbraco.Core.Services
var repository = RepositoryFactory.CreateMediaRepository(uow);
repository.Delete(media);
- deleteEventArgs.CanCancel = false;
+ deleteEventArgs.CanCancel = false;
uow.Events.Dispatch(Deleted, this, deleteEventArgs);
Audit(uow, AuditType.Delete, "Delete Media performed by user", userId, media.Id);