Merge origin/dev-v7.6 into dev-v8-zbwip (builds, not tested)

This commit is contained in:
Stephan
2016-11-23 10:33:12 +01:00
171 changed files with 3049 additions and 2024 deletions

View File

@@ -28,14 +28,22 @@ namespace Umbraco.Core.Services
IDatabaseUnitOfWorkProvider provider,
ILogger logger,
IEventMessagesFactory eventMessagesFactory,
IQueryFactory queryFactory,
MediaFileSystem mediaFileSystem)
: base(provider, logger, eventMessagesFactory)
{
_mediaFileSystem = mediaFileSystem;
_notTrashedQuery = queryFactory.Create<IContent>().Where(x => x.Trashed == false);
}
#endregion
#region Static Queries
private readonly IQuery<IContent> _notTrashedQuery;
#endregion
#region Count
public int CountPublished(string contentTypeAlias = null)
@@ -826,8 +834,7 @@ namespace Umbraco.Core.Services
{
uow.ReadLock(Constants.Locks.ContentTree);
var repository = uow.CreateRepository<IContentRepository>();
var query = repository.Query.Where(x => x.Trashed == false);
var content = repository.GetByPublishedVersion(query);
var content = repository.GetByPublishedVersion(_notTrashedQuery);
uow.Complete();
return content;
}

View File

@@ -20,17 +20,18 @@ namespace Umbraco.Core.Services
{
private readonly IRuntimeCacheProvider _runtimeCache;
private readonly Dictionary<string, Tuple<UmbracoObjectTypes, Func<int, IUmbracoEntity>>> _supportedObjectTypes;
public EntityService(IDatabaseUnitOfWorkProvider provider, ILogger logger, IEventMessagesFactory eventMessagesFactory,
IContentService contentService, IContentTypeService contentTypeService,
IContentService contentService, IContentTypeService contentTypeService,
IMediaService mediaService, IMediaTypeService mediaTypeService,
IDataTypeService dataTypeService,
IMemberService memberService, IMemberTypeService memberTypeService,
IQueryFactory queryFactory,
IRuntimeCacheProvider runtimeCache)
: base(provider, logger, eventMessagesFactory)
{
_runtimeCache = runtimeCache;
_rootEntityQuery = queryFactory.Create<IUmbracoEntity>().Where(x => x.ParentId == -1);
_supportedObjectTypes = new Dictionary<string, Tuple<UmbracoObjectTypes, Func<int, IUmbracoEntity>>>
{
@@ -60,12 +61,18 @@ namespace Umbraco.Core.Services
// ParentId = found.ParentId
// };
// }
//})}
};
}
#region Static Queries
private readonly IQuery<IUmbracoEntity> _rootEntityQuery;
#endregion
/// <summary>
/// Returns the integer id for a given GUID
/// </summary>
@@ -108,7 +115,7 @@ namespace Umbraco.Core.Services
}
uow.Complete();
return id;
}
}
});
return result.HasValue ? Attempt.Succeed(result.Value) : Attempt<int>.Fail();
}
@@ -435,8 +442,7 @@ namespace Umbraco.Core.Services
using (var uow = UowProvider.CreateUnitOfWork())
{
var repository = uow.CreateRepository<IEntityRepository>();
var query = repository.Query.Where(x => x.ParentId == -1);
var entities = repository.GetByQuery(query, objectTypeId);
var entities = repository.GetByQuery(_rootEntityQuery, objectTypeId);
uow.Complete();
return entities;
}

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Xml.Linq;
using Umbraco.Core.Configuration;
using System.IO;
using Umbraco.Core.Models;