Updating EntityService and repository to add content and media specific properties to the UmbracoEntity for performance enhancements.

Adding sample implementation in the BaseMediaTree but keeping it commented out as it won't work with the legacy events.
And a bit of code cleanup
This commit is contained in:
Morten Christensen
2013-04-03 05:25:26 -02:00
parent 99a63a3cdb
commit a4c9c3bfd9
8 changed files with 263 additions and 86 deletions

View File

@@ -164,13 +164,13 @@ namespace Umbraco.Core.Services
/// <summary>
/// Gets a collection of children by the parents Id
/// </summary>
/// <param name="id">Id of the parent to retrieve children for</param>
/// <param name="parentId">Id of the parent to retrieve children for</param>
/// <returns>An enumerable list of <see cref="IUmbracoEntity"/> objects</returns>
public virtual IEnumerable<IUmbracoEntity> GetChildren(int id)
public virtual IEnumerable<IUmbracoEntity> GetChildren(int parentId)
{
using (var repository = _repositoryFactory.CreateEntityRepository(_uowProvider.GetUnitOfWork()))
{
var query = Query<IUmbracoEntity>.Builder.Where(x => x.ParentId == id);
var query = Query<IUmbracoEntity>.Builder.Where(x => x.ParentId == parentId);
var contents = repository.GetByQuery(query);
return contents;
@@ -180,15 +180,15 @@ namespace Umbraco.Core.Services
/// <summary>
/// Gets a collection of children by the parents Id and UmbracoObjectType
/// </summary>
/// <param name="id">Id of the parent to retrieve children for</param>
/// <param name="parentId">Id of the parent to retrieve children for</param>
/// <param name="umbracoObjectType">UmbracoObjectType of the children to retrieve</param>
/// <returns>An enumerable list of <see cref="IUmbracoEntity"/> objects</returns>
public virtual IEnumerable<IUmbracoEntity> GetChildren(int id, UmbracoObjectTypes umbracoObjectType)
public virtual IEnumerable<IUmbracoEntity> GetChildren(int parentId, UmbracoObjectTypes umbracoObjectType)
{
var objectTypeId = umbracoObjectType.GetGuid();
using (var repository = _repositoryFactory.CreateEntityRepository(_uowProvider.GetUnitOfWork()))
{
var query = Query<IUmbracoEntity>.Builder.Where(x => x.ParentId == id);
var query = Query<IUmbracoEntity>.Builder.Where(x => x.ParentId == parentId);
var contents = repository.GetByQuery(query, objectTypeId);
return contents;