diff --git a/src/Umbraco.Core/Services/EntityService.cs b/src/Umbraco.Core/Services/EntityService.cs index f4b1b71732..84f5e2d9fd 100644 --- a/src/Umbraco.Core/Services/EntityService.cs +++ b/src/Umbraco.Core/Services/EntityService.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Linq.Expressions; using Umbraco.Core.CodeAnnotations; @@ -717,5 +718,32 @@ namespace Umbraco.Core.Services } return node.NodeId; } + + #region Obsolete - only here for compat + + [Obsolete("Use the overload that doesn't specify loadBaseType instead, loadBaseType will not affect any results")] + [EditorBrowsable(EditorBrowsableState.Never)] + public IUmbracoEntity GetByKey(Guid key, bool loadBaseType = true) => GetByKey(key); + + [Obsolete("Use the overload that doesn't specify loadBaseType instead, loadBaseType will not affect any results")] + [EditorBrowsable(EditorBrowsableState.Never)] + public IUmbracoEntity Get(int id, bool loadBaseType = true) => Get(id); + + [Obsolete("Use the overload that doesn't specify loadBaseType instead, loadBaseType will not affect any results")] + [EditorBrowsable(EditorBrowsableState.Never)] + public IUmbracoEntity GetByKey(Guid key, UmbracoObjectTypes umbracoObjectType, bool loadBaseType = true) => GetByKey(key, umbracoObjectType); + + [Obsolete("Use the overload that doesn't specify loadBaseType instead, loadBaseType will not affect any results")] + [EditorBrowsable(EditorBrowsableState.Never)] + public IUmbracoEntity GetByKey(Guid key, bool loadBaseType = true) where T : IUmbracoEntity => GetByKey(key); + + [Obsolete("Use the overload that doesn't specify loadBaseType instead, loadBaseType will not affect any results")] + [EditorBrowsable(EditorBrowsableState.Never)] + public IUmbracoEntity Get(int id, UmbracoObjectTypes umbracoObjectType, bool loadBaseType = true) => Get(id, umbracoObjectType); + + [Obsolete("Use the overload that doesn't specify loadBaseType instead, loadBaseType will not affect any results")] + [EditorBrowsable(EditorBrowsableState.Never)] + public IUmbracoEntity Get(int id, bool loadBaseType = true) where T : IUmbracoEntity => Get(id); + #endregion } } diff --git a/src/Umbraco.Core/Services/IEntityService.cs b/src/Umbraco.Core/Services/IEntityService.cs index a6a2254138..a0c7363c60 100644 --- a/src/Umbraco.Core/Services/IEntityService.cs +++ b/src/Umbraco.Core/Services/IEntityService.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using Umbraco.Core.Models; using Umbraco.Core.Models.EntityBase; using Umbraco.Core.Persistence.DatabaseModelDefinitions; @@ -55,6 +56,10 @@ namespace Umbraco.Core.Services /// An IUmbracoEntity GetByKey(Guid key); + [Obsolete("Use the overload that doesn't specify loadBaseType instead, loadBaseType will not affect any results")] + [EditorBrowsable(EditorBrowsableState.Never)] + IUmbracoEntity GetByKey(Guid key, bool loadBaseType = true); + /// /// Gets an UmbracoEntity by its Id, and optionally loads the complete object graph. /// @@ -62,9 +67,13 @@ namespace Umbraco.Core.Services /// By default this will load the base type with a minimum set of properties. /// /// Id of the object to retrieve - /// An + /// An IUmbracoEntity Get(int id); + [Obsolete("Use the overload that doesn't specify loadBaseType instead, loadBaseType will not affect any results")] + [EditorBrowsable(EditorBrowsableState.Never)] + IUmbracoEntity Get(int id, bool loadBaseType = true); + /// /// Gets an UmbracoEntity by its Id and UmbracoObjectType, and optionally loads the complete object graph. /// @@ -76,6 +85,14 @@ namespace Umbraco.Core.Services /// An IUmbracoEntity GetByKey(Guid key, UmbracoObjectTypes umbracoObjectType); + [Obsolete("Use the overload that doesn't specify loadBaseType instead, loadBaseType will not affect any results")] + [EditorBrowsable(EditorBrowsableState.Never)] + IUmbracoEntity GetByKey(Guid key, UmbracoObjectTypes umbracoObjectType, bool loadBaseType = true); + + [Obsolete("Use the overload that doesn't specify loadBaseType instead, loadBaseType will not affect any results")] + [EditorBrowsable(EditorBrowsableState.Never)] + IUmbracoEntity GetByKey(Guid key, bool loadBaseType = true) where T : IUmbracoEntity; + /// /// Gets an UmbracoEntity by its Id and UmbracoObjectType, and optionally loads the complete object graph. /// @@ -87,6 +104,9 @@ namespace Umbraco.Core.Services /// An IUmbracoEntity Get(int id, UmbracoObjectTypes umbracoObjectType); + [Obsolete("Use the overload that doesn't specify loadBaseType instead, loadBaseType will not affect any results")] + [EditorBrowsable(EditorBrowsableState.Never)] + IUmbracoEntity Get(int id, UmbracoObjectTypes umbracoObjectType, bool loadBaseType = true); /// /// Gets an UmbracoEntity by its Id and specified Type. Optionally loads the complete object graph. @@ -99,6 +119,10 @@ namespace Umbraco.Core.Services /// An IUmbracoEntity Get(int id) where T : IUmbracoEntity; + [Obsolete("Use the overload that doesn't specify loadBaseType instead, loadBaseType will not affect any results")] + [EditorBrowsable(EditorBrowsableState.Never)] + IUmbracoEntity Get(int id, bool loadBaseType = true) where T : IUmbracoEntity; + /// /// Gets the parent of entity by its id /// diff --git a/src/Umbraco.Core/Services/IRelationService.cs b/src/Umbraco.Core/Services/IRelationService.cs index b5ca9ee019..819952b697 100644 --- a/src/Umbraco.Core/Services/IRelationService.cs +++ b/src/Umbraco.Core/Services/IRelationService.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using Umbraco.Core.Models; using Umbraco.Core.Models.EntityBase; @@ -145,6 +146,10 @@ namespace Umbraco.Core.Services /// An IUmbracoEntity GetChildEntityFromRelation(IRelation relation); + [Obsolete("Use the overload that doesn't specify loadBaseType instead, loadBaseType will not affect any results")] + [EditorBrowsable(EditorBrowsableState.Never)] + IUmbracoEntity GetChildEntityFromRelation(IRelation relation, bool loadBaseType = false); + /// /// Gets the Parent object from a Relation as an /// @@ -152,6 +157,10 @@ namespace Umbraco.Core.Services /// An IUmbracoEntity GetParentEntityFromRelation(IRelation relation); + [Obsolete("Use the overload that doesn't specify loadBaseType instead, loadBaseType will not affect any results")] + [EditorBrowsable(EditorBrowsableState.Never)] + IUmbracoEntity GetParentEntityFromRelation(IRelation relation, bool loadBaseType = false); + /// /// Gets the Parent and Child objects from a Relation as a "/> with . /// @@ -159,6 +168,10 @@ namespace Umbraco.Core.Services /// Returns a Tuple with Parent (item1) and Child (item2) Tuple GetEntitiesFromRelation(IRelation relation); + [Obsolete("Use the overload that doesn't specify loadBaseType instead, loadBaseType will not affect any results")] + [EditorBrowsable(EditorBrowsableState.Never)] + Tuple GetEntitiesFromRelation(IRelation relation, bool loadBaseType = false); + /// /// Gets the Child objects from a list of Relations as a list of objects. /// @@ -166,6 +179,10 @@ namespace Umbraco.Core.Services /// An enumerable list of IEnumerable GetChildEntitiesFromRelations(IEnumerable relations); + [Obsolete("Use the overload that doesn't specify loadBaseType instead, loadBaseType will not affect any results")] + [EditorBrowsable(EditorBrowsableState.Never)] + IEnumerable GetChildEntitiesFromRelations(IEnumerable relations, bool loadBaseType = false); + /// /// Gets the Parent objects from a list of Relations as a list of objects. /// @@ -173,6 +190,10 @@ namespace Umbraco.Core.Services /// An enumerable list of IEnumerable GetParentEntitiesFromRelations(IEnumerable relations); + [Obsolete("Use the overload that doesn't specify loadBaseType instead, loadBaseType will not affect any results")] + [EditorBrowsable(EditorBrowsableState.Never)] + IEnumerable GetParentEntitiesFromRelations(IEnumerable relations, bool loadBaseType = false); + /// /// Gets the Parent and Child objects from a list of Relations as a list of objects. /// @@ -181,6 +202,12 @@ namespace Umbraco.Core.Services IEnumerable> GetEntitiesFromRelations( IEnumerable relations); + [Obsolete("Use the overload that doesn't specify loadBaseType instead, loadBaseType will not affect any results")] + [EditorBrowsable(EditorBrowsableState.Never)] + IEnumerable> GetEntitiesFromRelations( + IEnumerable relations, + bool loadBaseType = false); + /// /// Relates two objects by their entity Ids. /// diff --git a/src/Umbraco.Core/Services/RelationService.cs b/src/Umbraco.Core/Services/RelationService.cs index a940096ded..7ddd2ecf12 100644 --- a/src/Umbraco.Core/Services/RelationService.cs +++ b/src/Umbraco.Core/Services/RelationService.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using Umbraco.Core.Events; using Umbraco.Core.Logging; @@ -736,5 +737,31 @@ namespace Umbraco.Core.Services /// public static event TypedEventHandler> SavedRelationType; #endregion + + #region Obsolete - only here for compat + [Obsolete("Use the overload that doesn't specify loadBaseType instead, loadBaseType will not affect any results")] + [EditorBrowsable(EditorBrowsableState.Never)] + public IUmbracoEntity GetChildEntityFromRelation(IRelation relation, bool loadBaseType = false) => GetChildEntityFromRelation(relation); + + [Obsolete("Use the overload that doesn't specify loadBaseType instead, loadBaseType will not affect any results")] + [EditorBrowsable(EditorBrowsableState.Never)] + public IUmbracoEntity GetParentEntityFromRelation(IRelation relation, bool loadBaseType = false) => GetParentEntityFromRelation(relation); + + [Obsolete("Use the overload that doesn't specify loadBaseType instead, loadBaseType will not affect any results")] + [EditorBrowsable(EditorBrowsableState.Never)] + public Tuple GetEntitiesFromRelation(IRelation relation, bool loadBaseType = false) => GetEntitiesFromRelation(relation); + + [Obsolete("Use the overload that doesn't specify loadBaseType instead, loadBaseType will not affect any results")] + [EditorBrowsable(EditorBrowsableState.Never)] + public IEnumerable GetChildEntitiesFromRelations(IEnumerable relations, bool loadBaseType = false) => GetChildEntitiesFromRelations(relations); + + [Obsolete("Use the overload that doesn't specify loadBaseType instead, loadBaseType will not affect any results")] + [EditorBrowsable(EditorBrowsableState.Never)] + public IEnumerable GetParentEntitiesFromRelations(IEnumerable relations, bool loadBaseType = false) => GetParentEntitiesFromRelations(relations); + + [Obsolete("Use the overload that doesn't specify loadBaseType instead, loadBaseType will not affect any results")] + [EditorBrowsable(EditorBrowsableState.Never)] + public IEnumerable> GetEntitiesFromRelations(IEnumerable relations, bool loadBaseType = false) => GetEntitiesFromRelations(relations); + #endregion } }