diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/EntityRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/EntityRepository.cs index 30de08edc5..4a32e373c1 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/EntityRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/EntityRepository.cs @@ -240,21 +240,6 @@ namespace Umbraco.Core.Persistence.Repositories.Implement return GetEntities(sql, isContent, isMedia); } - //// TODO: See https://github.com/umbraco/Umbraco-CMS/pull/3460#issuecomment-434903930 we need to not load any property data at all for media - //internal IEnumerable GetMediaByQueryWithoutPropertyData(IQuery query) - //{ - // var isContent = false; - // var isMedia = true; - - // var sql = GetBaseWhere(isContent, isMedia, false, null, Constants.ObjectTypes.Media); - - // var translator = new SqlTranslator(sql, query); - // sql = translator.Translate(); - // sql = AddGroupBy(isContent, isMedia, sql, true); - - // return GetEntities(sql, isContent, isMedia, false); - //} - public UmbracoObjectTypes GetObjectType(int id) { var sql = Sql().Select(x => x.NodeObjectType).From().Where(x => x.NodeId == id); @@ -279,41 +264,6 @@ namespace Umbraco.Core.Persistence.Repositories.Implement return Database.ExecuteScalar(sql) > 0; } - //// TODO: see https://github.com/umbraco/Umbraco-CMS/pull/3460#issuecomment-434903930 we need to not load any property data at all for media - //private void BuildProperties(EntitySlim entity, BaseDto dto) - //{ - // var pdtos = Database.Fetch(GetPropertyData(dto.VersionId)); - // foreach (var pdto in pdtos) - // BuildProperty(entity, pdto); - //} - - //// TODO: see https://github.com/umbraco/Umbraco-CMS/pull/3460#issuecomment-434903930 we need to not load any property data at all for media - //private void BuildProperties(EntitySlim[] entities, List dtos) - //{ - // var versionIds = dtos.Select(x => x.VersionId).Distinct().ToList(); - // var pdtos = Database.FetchByGroups(versionIds, 2000, GetPropertyData); - - // var xentity = entities.ToDictionary(x => x.Id, x => x); // nodeId -> entity - // var xdto = dtos.ToDictionary(x => x.VersionId, x => x.NodeId); // versionId -> nodeId - // foreach (var pdto in pdtos) - // { - // var nodeId = xdto[pdto.VersionId]; - // var entity = xentity[nodeId]; - // BuildProperty(entity, pdto); - // } - //} - - //// TODO: see https://github.com/umbraco/Umbraco-CMS/pull/3460#issuecomment-434903930 we need to not load any property data at all for media - //private void BuildProperty(EntitySlim entity, PropertyDataDto pdto) - //{ - // // explain ?! - // var value = string.IsNullOrWhiteSpace(pdto.TextValue) - // ? pdto.VarcharValue - // : pdto.TextValue.ConvertToJsonIfPossible(); - - // entity.AdditionalData[pdto.PropertyTypeDto.Alias] = new EntitySlim.PropertySlim(pdto.PropertyTypeDto.DataTypeDto.EditorAlias, value); - //} - private DocumentEntitySlim BuildVariants(DocumentEntitySlim entity) => BuildVariants(new[] { entity }).First(); @@ -399,27 +349,6 @@ namespace Umbraco.Core.Persistence.Repositories.Implement return AddGroupBy(isContent, isMedia, sql, true); } - //private Sql GetPropertyData(int versionId) - //{ - // return Sql() - // .Select(r => r.Select(x => x.PropertyTypeDto, r1 => r1.Select(x => x.DataTypeDto))) - // .From() - // .InnerJoin().On((left, right) => left.PropertyTypeId == right.Id) - // .InnerJoin().On((left, right) => left.DataTypeId == right.NodeId) - // .Where(x => x.VersionId == versionId); - //} - - //private Sql GetPropertyData(IEnumerable versionIds) - //{ - // return Sql() - // .Select(r => r.Select(x => x.PropertyTypeDto, r1 => r1.Select(x => x.DataTypeDto))) - // .From() - // .InnerJoin().On((left, right) => left.PropertyTypeId == right.Id) - // .InnerJoin().On((left, right) => left.DataTypeId == right.NodeId) - // .WhereIn(x => x.VersionId, versionIds) - // .OrderBy(x => x.VersionId); - //} - // gets the base SELECT + FROM [+ filter] sql // always from the 'current' content version protected Sql GetBase(bool isContent, bool isMedia, Action> filter, bool isCount = false) @@ -583,23 +512,6 @@ namespace Umbraco.Core.Persistence.Repositories.Implement #region Classes - //[ExplicitColumns] - //internal class UmbracoPropertyDto - //{ - // [Column("propertyEditorAlias")] - // public string PropertyEditorAlias { get; set; } - - // [Column("propertyTypeAlias")] - // public string PropertyAlias { get; set; } - - // [Column("varcharValue")] - // public string VarcharValue { get; set; } - - // [Column("textValue")] - // public string TextValue { get; set; } - //} - - /// /// The DTO used to fetch results for a content item with its variation info /// diff --git a/src/Umbraco.Core/Services/Implement/EntityService.cs b/src/Umbraco.Core/Services/Implement/EntityService.cs index f8317dbd23..04e2624592 100644 --- a/src/Umbraco.Core/Services/Implement/EntityService.cs +++ b/src/Umbraco.Core/Services/Implement/EntityService.cs @@ -7,11 +7,9 @@ using Umbraco.Core.Logging; using Umbraco.Core.Models; using Umbraco.Core.Models.Entities; using Umbraco.Core.Persistence; -using Umbraco.Core.Persistence.DatabaseModelDefinitions; using Umbraco.Core.Persistence.Dtos; using Umbraco.Core.Persistence.Querying; using Umbraco.Core.Persistence.Repositories; -using Umbraco.Core.Persistence.Repositories.Implement; using Umbraco.Core.Scoping; namespace Umbraco.Core.Services.Implement @@ -276,22 +274,6 @@ namespace Umbraco.Core.Services.Implement } } - ///// - ///// Gets a collection of children by the parent's Id and UmbracoObjectType without adding property data - ///// - ///// Id of the parent to retrieve children for - ///// An enumerable list of objects - //internal IEnumerable GetMediaChildrenWithoutPropertyData(int parentId) - //{ - // using (ScopeProvider.CreateScope(autoComplete: true)) - // { - // var query = Query().Where(x => x.ParentId == parentId); - - // // TODO: see https://github.com/umbraco/Umbraco-CMS/pull/3460#issuecomment-434903930 we need to not load any property data at all for media - // return ((EntityRepository)_entityRepository).GetMediaByQueryWithoutPropertyData(query); - // } - //} - /// public virtual IEnumerable GetDescendants(int id) { diff --git a/src/Umbraco.Web/Trees/ContentTreeController.cs b/src/Umbraco.Web/Trees/ContentTreeController.cs index ef9f57e7e1..9e481fc4c9 100644 --- a/src/Umbraco.Web/Trees/ContentTreeController.cs +++ b/src/Umbraco.Web/Trees/ContentTreeController.cs @@ -201,9 +201,6 @@ namespace Umbraco.Web.Trees return HasPathAccess(entity, queryStrings); } - //internal override IEnumerable GetChildrenFromEntityService(int entityId) - // => Services.EntityService.GetChildren(entityId, UmbracoObjectType).ToList(); - protected override IEnumerable GetChildEntities(string id, FormDataCollection queryStrings) { var result = base.GetChildEntities(id, queryStrings); @@ -327,7 +324,7 @@ namespace Umbraco.Web.Trees public IEnumerable Search(string query, int pageSize, long pageIndex, out long totalFound, string searchFrom = null) { - return _treeSearcher.ExamineSearch(query, UmbracoEntityTypes.Document, pageSize, pageIndex, out totalFound, false, searchFrom); + return _treeSearcher.ExamineSearch(query, UmbracoEntityTypes.Document, pageSize, pageIndex, out totalFound, searchFrom); } } } diff --git a/src/Umbraco.Web/Trees/MediaTreeController.cs b/src/Umbraco.Web/Trees/MediaTreeController.cs index 0f176f3ee1..22ad4ed355 100644 --- a/src/Umbraco.Web/Trees/MediaTreeController.cs +++ b/src/Umbraco.Web/Trees/MediaTreeController.cs @@ -164,17 +164,8 @@ namespace Umbraco.Web.Trees public IEnumerable Search(string query, int pageSize, long pageIndex, out long totalFound, string searchFrom = null) { - return _treeSearcher.ExamineSearch(query, UmbracoEntityTypes.Media, pageSize, pageIndex, out totalFound, false, searchFrom); + return _treeSearcher.ExamineSearch(query, UmbracoEntityTypes.Media, pageSize, pageIndex, out totalFound, searchFrom); } - //internal override IEnumerable GetChildrenFromEntityService(int entityId) - // => Services.EntityService.GetChildren(entityId, UmbracoObjectType).ToList(); - - //internal override IEnumerable GetChildrenFromEntityService(int entityId) - // // Not pretty having to cast the service, but it is the only way to get to use an internal method that we - // // do not want to make public on the interface. Unfortunately also prevents this from being unit tested. - // // See this issue for details on why we need this: - // // https://github.com/umbraco/Umbraco-CMS/issues/3457 - // => ((EntityService)Services.EntityService).GetMediaChildrenWithoutPropertyData(entityId).ToList(); } }