View Source
Class EntityService
Inheritance
System.Object
Assembly: Umbraco.Core.dll
Syntax
public class EntityService : RepositoryService, IService, IEntityService
Constructors
View Source
EntityService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IIdKeyMap, IEntityRepository)
Declaration
public EntityService(ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IIdKeyMap idKeyMap, IEntityRepository entityRepository)
Parameters
Methods
View Source
Exists(Guid)
Determines whether an entity exists.
Declaration
public bool Exists(Guid key)
Parameters
| Type |
Name |
Description |
| Guid |
key |
The unique key of the entity.
|
Returns
| Type |
Description |
| System.Boolean |
|
View Source
Exists(Guid, UmbracoObjectTypes)
Determines whether and entity of a certain object type exists.
Declaration
public bool Exists(Guid key, UmbracoObjectTypes objectType)
Parameters
| Type |
Name |
Description |
| Guid |
key |
The unique key of the entity.
|
| UmbracoObjectTypes |
objectType |
The object type to look for.
|
Returns
| Type |
Description |
| System.Boolean |
True if the entity exists, false if it does not.
|
View Source
Exists(IEnumerable<Guid>)
Declaration
public bool Exists(IEnumerable<Guid> keys)
Parameters
| Type |
Name |
Description |
| IEnumerable<Guid> |
keys |
|
Returns
| Type |
Description |
| System.Boolean |
|
View Source
Exists(Int32)
Determines whether an entity exists.
Declaration
public bool Exists(int id)
Parameters
| Type |
Name |
Description |
| System.Int32 |
id |
The identifier of the entity.
|
Returns
| Type |
Description |
| System.Boolean |
|
View Source
Exists(Int32, UmbracoObjectTypes)
Determines whether and entity of a certain object type exists.
Declaration
public bool Exists(int id, UmbracoObjectTypes objectType)
Parameters
| Type |
Name |
Description |
| System.Int32 |
id |
The id of the entity.
|
| UmbracoObjectTypes |
objectType |
The object type to look for.
|
Returns
| Type |
Description |
| System.Boolean |
True if the entity exists, false if it does not.
|
View Source
Get(Guid)
Declaration
public IEntitySlim Get(Guid key)
Parameters
| Type |
Name |
Description |
| Guid |
key |
The unique key of the entity.
|
Returns
View Source
Get(Guid, UmbracoObjectTypes)
Declaration
public IEntitySlim Get(Guid key, UmbracoObjectTypes objectType)
Parameters
| Type |
Name |
Description |
| Guid |
key |
The unique key of the entity.
|
| UmbracoObjectTypes |
objectType |
The object type of the entity.
|
Returns
View Source
Get(Int32)
Declaration
public IEntitySlim Get(int id)
Parameters
| Type |
Name |
Description |
| System.Int32 |
id |
The identifier of the entity.
|
Returns
View Source
Get(Int32, UmbracoObjectTypes)
Declaration
public virtual IEntitySlim Get(int id, UmbracoObjectTypes objectType)
Parameters
| Type |
Name |
Description |
| System.Int32 |
id |
The identifier of the entity.
|
| UmbracoObjectTypes |
objectType |
The object type of the entity.
|
Returns
View Source
Get<T>(Guid)
Declaration
public virtual IEntitySlim Get<T>(Guid key)
where T : IUmbracoEntity
Parameters
| Type |
Name |
Description |
| Guid |
key |
The unique key of the entity.
|
Returns
Type Parameters
| Name |
Description |
| T |
The type used to determine the object type of the entity.
|
View Source
Get<T>(Int32)
Declaration
public virtual IEntitySlim Get<T>(int id)
where T : IUmbracoEntity
Parameters
| Type |
Name |
Description |
| System.Int32 |
id |
The identifier of the entity.
|
Returns
Type Parameters
| Name |
Description |
| T |
The type used to determine the object type of the entity.
|
View Source
GetAll(Guid)
Gets entities of a given object type.
Declaration
public virtual IEnumerable<IEntitySlim> GetAll(Guid objectType)
Parameters
| Type |
Name |
Description |
| Guid |
objectType |
The object type of the entities.
|
Returns
View Source
GetAll(Guid, Guid[])
Gets entities of a given object type.
Declaration
public virtual IEnumerable<IEntitySlim> GetAll(Guid objectType, params Guid[] keys)
Parameters
| Type |
Name |
Description |
| Guid |
objectType |
The object type of the entities.
|
| Guid[] |
keys |
The unique identifiers of the entities.
|
Returns
View Source
GetAll(Guid, Int32[])
Gets entities of a given object type.
Declaration
public virtual IEnumerable<IEntitySlim> GetAll(Guid objectType, params int[] ids)
Parameters
| Type |
Name |
Description |
| Guid |
objectType |
The object type of the entities.
|
| System.Int32[] |
ids |
The identifiers of the entities.
|
Returns
View Source
GetAll(UmbracoObjectTypes)
Gets entities of a given object type.
Declaration
public virtual IEnumerable<IEntitySlim> GetAll(UmbracoObjectTypes objectType)
Parameters
Returns
View Source
GetAll(UmbracoObjectTypes, Guid[])
Gets entities of a given object type.
Declaration
public IEnumerable<IEntitySlim> GetAll(UmbracoObjectTypes objectType, Guid[] keys)
Parameters
| Type |
Name |
Description |
| UmbracoObjectTypes |
objectType |
The object type of the entities.
|
| Guid[] |
keys |
The unique identifiers of the entities.
|
Returns
View Source
GetAll(UmbracoObjectTypes, Int32[])
Gets entities of a given object type.
Declaration
public virtual IEnumerable<IEntitySlim> GetAll(UmbracoObjectTypes objectType, params int[] ids)
Parameters
| Type |
Name |
Description |
| UmbracoObjectTypes |
objectType |
The object type of the entities.
|
| System.Int32[] |
ids |
The identifiers of the entities.
|
Returns
View Source
GetAll<T>()
Gets entities of a given object type.
Declaration
public virtual IEnumerable<IEntitySlim> GetAll<T>()
where T : IUmbracoEntity
Returns
Type Parameters
| Name |
Description |
| T |
The type used to determine the object type of the entities.
|
View Source
GetAll<T>(Guid[])
Gets entities of a given object type.
Declaration
public virtual IEnumerable<IEntitySlim> GetAll<T>(params Guid[] keys)
where T : IUmbracoEntity
Parameters
| Type |
Name |
Description |
| Guid[] |
keys |
The unique identifiers of the entities.
|
Returns
Type Parameters
| Name |
Description |
| T |
The type used to determine the object type of the entities.
|
View Source
GetAll<T>(Int32[])
Gets entities of a given object type.
Declaration
public virtual IEnumerable<IEntitySlim> GetAll<T>(params int[] ids)
where T : IUmbracoEntity
Parameters
| Type |
Name |
Description |
| System.Int32[] |
ids |
The identifiers of the entities.
|
Returns
Type Parameters
| Name |
Description |
| T |
The type used to determine the object type of the entities.
|
View Source
GetAllPaths(UmbracoObjectTypes, Guid[])
Declaration
public virtual IEnumerable<TreeEntityPath> GetAllPaths(UmbracoObjectTypes objectType, params Guid[] keys)
Parameters
Returns
View Source
GetAllPaths(UmbracoObjectTypes, Int32[])
Declaration
public virtual IEnumerable<TreeEntityPath> GetAllPaths(UmbracoObjectTypes objectType, params int[] ids)
Parameters
Returns
View Source
GetChildren(Int32)
Gets the children of an entity.
Declaration
public virtual IEnumerable<IEntitySlim> GetChildren(int parentId)
Parameters
| Type |
Name |
Description |
| System.Int32 |
parentId |
|
Returns
View Source
GetChildren(Int32, UmbracoObjectTypes)
Gets the children of an entity.
Declaration
public virtual IEnumerable<IEntitySlim> GetChildren(int parentId, UmbracoObjectTypes objectType)
Parameters
| Type |
Name |
Description |
| System.Int32 |
parentId |
|
| UmbracoObjectTypes |
objectType |
The object type of the children.
|
Returns
View Source
GetChildren(Nullable<Guid>, UmbracoObjectTypes)
Declaration
public IEnumerable<IEntitySlim> GetChildren(Guid? key, UmbracoObjectTypes objectType)
Parameters
Returns
View Source
GetDescendants(Int32)
Gets the descendants of an entity.
Declaration
public virtual IEnumerable<IEntitySlim> GetDescendants(int id)
Parameters
| Type |
Name |
Description |
| System.Int32 |
id |
The identifier of the entity.
|
Returns
View Source
GetDescendants(Int32, UmbracoObjectTypes)
Gets the descendants of an entity.
Declaration
public virtual IEnumerable<IEntitySlim> GetDescendants(int id, UmbracoObjectTypes objectType)
Parameters
| Type |
Name |
Description |
| System.Int32 |
id |
The identifier of the entity.
|
| UmbracoObjectTypes |
objectType |
The object type of the descendants.
|
Returns
View Source
GetEntityType(Int32)
Gets the CLR type of an entity.
Declaration
public virtual Type? GetEntityType(int id)
Parameters
| Type |
Name |
Description |
| System.Int32 |
id |
|
Returns
| Type |
Description |
| System.Nullable<Type> |
|
View Source
GetId(Guid, UmbracoObjectTypes)
Gets the integer identifier corresponding to a unique Guid identifier.
Declaration
public Attempt<int> GetId(Guid key, UmbracoObjectTypes objectType)
Parameters
Returns
| Type |
Description |
| Attempt<System.Int32> |
|
View Source
GetId(Udi)
Gets the integer identifier corresponding to a Udi.
Declaration
public Attempt<int> GetId(Udi udi)
Parameters
| Type |
Name |
Description |
| Udi |
udi |
|
Returns
| Type |
Description |
| Attempt<System.Int32> |
|
View Source
GetKey(Int32, UmbracoObjectTypes)
Gets the unique Guid identifier corresponding to an integer identifier.
Declaration
public Attempt<Guid> GetKey(int id, UmbracoObjectTypes umbracoObjectType)
Parameters
Returns
View Source
GetObjectType(Guid)
Gets the object type of an entity.
Declaration
public virtual UmbracoObjectTypes GetObjectType(Guid key)
Parameters
| Type |
Name |
Description |
| Guid |
key |
|
Returns
View Source
GetObjectType(Int32)
Gets the object type of an entity.
Declaration
public virtual UmbracoObjectTypes GetObjectType(int id)
Parameters
| Type |
Name |
Description |
| System.Int32 |
id |
|
Returns
View Source
GetObjectType(IUmbracoEntity)
Gets the object type of an entity.
Declaration
public virtual UmbracoObjectTypes GetObjectType(IUmbracoEntity entity)
Parameters
Returns
View Source
GetPagedChildren(Int32, UmbracoObjectTypes, Int64, Int32, out Int64, IQuery<IUmbracoEntity>, Ordering)
Gets children of an entity.
Declaration
public IEnumerable<IEntitySlim> GetPagedChildren(int id, UmbracoObjectTypes objectType, long pageIndex, int pageSize, out long totalRecords, IQuery<IUmbracoEntity> filter = null, Ordering ordering = null)
Parameters
Returns
View Source
GetPagedChildren(Nullable<Guid>, IEnumerable<UmbracoObjectTypes>, IEnumerable<UmbracoObjectTypes>, Int32, Int32, Boolean, out Int64, IQuery<IUmbracoEntity>, Ordering)
Declaration
public IEnumerable<IEntitySlim> GetPagedChildren(Guid? parentKey, IEnumerable<UmbracoObjectTypes> parentObjectTypes, IEnumerable<UmbracoObjectTypes> childObjectTypes, int skip, int take, bool trashed, out long totalRecords, IQuery<IUmbracoEntity> filter = null, Ordering ordering = null)
Parameters
Returns
View Source
GetPagedChildren(Nullable<Guid>, IEnumerable<UmbracoObjectTypes>, UmbracoObjectTypes, Int32, Int32, out Int64, IQuery<IUmbracoEntity>, Ordering)
Declaration
public IEnumerable<IEntitySlim> GetPagedChildren(Guid? parentKey, IEnumerable<UmbracoObjectTypes> parentObjectTypes, UmbracoObjectTypes childObjectType, int skip, int take, out long totalRecords, IQuery<IUmbracoEntity> filter = null, Ordering ordering = null)
Parameters
Returns
View Source
GetPagedChildren(Nullable<Guid>, UmbracoObjectTypes, Int32, Int32, out Int64, IQuery<IUmbracoEntity>, Ordering)
Declaration
public IEnumerable<IEntitySlim> GetPagedChildren(Guid? parentKey, UmbracoObjectTypes childObjectType, int skip, int take, out long totalRecords, IQuery<IUmbracoEntity> filter = null, Ordering ordering = null)
Parameters
Returns
View Source
GetPagedDescendants(IEnumerable<Int32>, UmbracoObjectTypes, Int64, Int32, out Int64, IQuery<IUmbracoEntity>, Ordering)
Gets descendants of entities.
Declaration
public IEnumerable<IEntitySlim> GetPagedDescendants(IEnumerable<int> ids, UmbracoObjectTypes objectType, long pageIndex, int pageSize, out long totalRecords, IQuery<IUmbracoEntity> filter = null, Ordering ordering = null)
Parameters
Returns
View Source
GetPagedDescendants(Int32, UmbracoObjectTypes, Int64, Int32, out Int64, IQuery<IUmbracoEntity>, Ordering)
Gets descendants of an entity.
Declaration
public IEnumerable<IEntitySlim> GetPagedDescendants(int id, UmbracoObjectTypes objectType, long pageIndex, int pageSize, out long totalRecords, IQuery<IUmbracoEntity> filter = null, Ordering ordering = null)
Parameters
Returns
View Source
GetPagedDescendants(UmbracoObjectTypes, Int64, Int32, out Int64, IQuery<IUmbracoEntity>, Ordering, Boolean)
Gets descendants of root.
Declaration
public IEnumerable<IEntitySlim> GetPagedDescendants(UmbracoObjectTypes objectType, long pageIndex, int pageSize, out long totalRecords, IQuery<IUmbracoEntity> filter = null, Ordering ordering = null, bool includeTrashed = true)
Parameters
Returns
View Source
GetPagedTrashedChildren(Int32, UmbracoObjectTypes, Int64, Int32, out Int64, IQuery<IUmbracoEntity>, Ordering)
Gets children of an entity.
Declaration
public IEnumerable<IEntitySlim> GetPagedTrashedChildren(int id, UmbracoObjectTypes objectType, long pageIndex, int pageSize, out long totalRecords, IQuery<IUmbracoEntity> filter = null, Ordering ordering = null)
Parameters
Returns
View Source
GetPagedTrashedChildren(Nullable<Guid>, UmbracoObjectTypes, Int32, Int32, out Int64, IQuery<IUmbracoEntity>, Ordering)
Declaration
public IEnumerable<IEntitySlim> GetPagedTrashedChildren(Guid? key, UmbracoObjectTypes objectType, int skip, int take, out long totalRecords, IQuery<IUmbracoEntity> filter = null, Ordering ordering = null)
Parameters
Returns
View Source
GetParent(Int32)
Gets the parent of an entity.
Declaration
public virtual IEntitySlim GetParent(int id)
Parameters
| Type |
Name |
Description |
| System.Int32 |
id |
The identifier of the entity.
|
Returns
View Source
GetParent(Int32, UmbracoObjectTypes)
Gets the parent of an entity.
Declaration
public virtual IEntitySlim GetParent(int id, UmbracoObjectTypes objectType)
Parameters
| Type |
Name |
Description |
| System.Int32 |
id |
The identifier of the entity.
|
| UmbracoObjectTypes |
objectType |
The object type of the parent.
|
Returns
View Source
GetPathKeys(ITreeEntity, Boolean)
Gets the GUID keys for an entity's path (provided as a comma separated list of integer Ids).
Declaration
public Guid[] GetPathKeys(ITreeEntity entity, bool omitSelf = false)
Parameters
| Type |
Name |
Description |
| ITreeEntity |
entity |
The entity.
|
| System.Boolean |
omitSelf |
A value indicating whether to omit the entity's own key from the result.
|
Returns
| Type |
Description |
| Guid[] |
The path with each ID converted to a GUID.
|
View Source
GetRootEntities(UmbracoObjectTypes)
Declaration
public virtual IEnumerable<IEntitySlim> GetRootEntities(UmbracoObjectTypes objectType)
Parameters
Returns
View Source
ReserveId(Guid)
Reserves an identifier for a key.
Declaration
public int ReserveId(Guid key)
Parameters
| Type |
Name |
Description |
| Guid |
key |
They key.
|
Returns
| Type |
Description |
| System.Int32 |
The identifier.
|