diff --git a/src/Umbraco.Core/SystemLock.cs b/src/Umbraco.Abstractions/SystemLock.cs
similarity index 99%
rename from src/Umbraco.Core/SystemLock.cs
rename to src/Umbraco.Abstractions/SystemLock.cs
index 4eaae7082b..704fc65123 100644
--- a/src/Umbraco.Core/SystemLock.cs
+++ b/src/Umbraco.Abstractions/SystemLock.cs
@@ -21,7 +21,7 @@ namespace Umbraco.Core
// been closed, the Semaphore system object is destroyed - so in any case
// an iisreset should clean up everything
//
- internal class SystemLock
+ public class SystemLock
{
private readonly SemaphoreSlim _semaphore;
private readonly Semaphore _semaphore2;
diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj
index 0c379eb45e..7ff3544f7a 100755
--- a/src/Umbraco.Core/Umbraco.Core.csproj
+++ b/src/Umbraco.Core/Umbraco.Core.csproj
@@ -126,7 +126,6 @@
Constants.cs
-->
-
diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentRepository.cs
index f3b9f6a0a2..ff4ac4e4dd 100644
--- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentRepository.cs
+++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentRepository.cs
@@ -100,9 +100,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
if (ids.Any())
sql.WhereIn(x => x.NodeId, ids);
- return MapDtosToContent(Database.Fetch(sql), false,
- // load everything
- true, true, true, true);
+ return MapDtosToContent(Database.Fetch(sql));
}
protected override IEnumerable PerformGetByQuery(IQuery query)
@@ -114,9 +112,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
AddGetByQueryOrderBy(sql);
- return MapDtosToContent(Database.Fetch(sql), false,
- // load everything
- true, true, true, true);
+ return MapDtosToContent(Database.Fetch(sql));
}
private void AddGetByQueryOrderBy(Sql sql)
@@ -255,9 +251,24 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
.OrderByDescending(x => x.Current)
.AndByDescending(x => x.VersionDate);
- return MapDtosToContent(Database.Fetch(sql), true, true, true, true, true);
+ return MapDtosToContent(Database.Fetch(sql), true);
}
+ // TODO: This method needs to return a readonly version of IContent! The content returned
+ // from this method does not contain all of the data required to re-persist it and if that
+ // is attempted some odd things will occur.
+ // Either we create an IContentReadOnly (which ultimately we should for vNext so we can
+ // differentiate between methods that return entities that can be re-persisted or not), or
+ // in the meantime to not break API compatibility, we can add a property to IContentBase
+ // (or go further and have it on IUmbracoEntity): "IsReadOnly" and if that is true we throw
+ // an exception if that entity is passed to a Save method.
+ // Ideally we return "Slim" versions of content for all sorts of methods here and in ContentService.
+ // Perhaps another non-breaking alternative is to have new services like IContentServiceReadOnly
+ // which can return IContentReadOnly.
+ // We have the ability with `MapDtosToContent` to reduce the amount of data looked up for a
+ // content item. Ideally for paged data that populates list views, these would be ultra slim
+ // content items, there's no reason to populate those with really anything apart from property data,
+ // but until we do something like the above, we can't do that since it would be breaking and unclear.
public override IEnumerable GetAllVersionsSlim(int nodeId, int skip, int take)
{
var sql = GetBaseQuery(QueryType.Many, false)
@@ -266,7 +277,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
.AndByDescending(x => x.VersionDate);
return MapDtosToContent(Database.Fetch(sql), true,
- // load bare minimum
+ // load bare minimum, need variants though since this is used to rollback with variants
false, false, false, true).Skip(skip).Take(take);
}
@@ -867,9 +878,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
}
return GetPage(query, pageIndex, pageSize, out totalRecords,
- x => MapDtosToContent(x, false,
- // load properties but nothing else
- true, false, false, true),
+ x => MapDtosToContent(x),
filterSql,
ordering);
}
@@ -956,9 +965,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
if (ids.Length > 0)
sql.WhereIn(x => x.UniqueId, ids);
- return _outerRepo.MapDtosToContent(Database.Fetch(sql), false,
- // load everything
- true, true, true, true);
+ return _outerRepo.MapDtosToContent(Database.Fetch(sql));
}
protected override IEnumerable PerformGetByQuery(IQuery query)
@@ -1016,9 +1023,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
AddGetByQueryOrderBy(sql);
- return MapDtosToContent(Database.Fetch(sql),
- // load the bare minimum
- false, false, false, true, true);
+ return MapDtosToContent(Database.Fetch(sql));
}
///
@@ -1034,9 +1039,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
AddGetByQueryOrderBy(sql);
- return MapDtosToContent(Database.Fetch(sql),
- // load the bare minimum
- false, false, false, true, true);
+ return MapDtosToContent(Database.Fetch(sql));
}
#endregion
@@ -1100,11 +1103,11 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
}
private IEnumerable MapDtosToContent(List dtos,
- bool withCache,
- bool loadProperties,
- bool loadTemplates,
- bool loadSchedule,
- bool loadVariants)
+ bool withCache = false,
+ bool loadProperties = true,
+ bool loadTemplates = true,
+ bool loadSchedule = true,
+ bool loadVariants = true)
{
var temps = new List>();
var contentTypes = new Dictionary();