Interface IEntityService
Namespace:System.Dynamic.ExpandoObject
Assembly:Umbraco.Core.dll
Syntax
public interface IEntityService
Methods
Exists(Guid)
Returns true if the entity exists
Declaration
bool Exists(Guid key)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | key |
Returns
Type | Description |
---|---|
System.Boolean |
Exists(Int32)
Returns true if the entity exists
Declaration
bool Exists(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id |
Returns
Type | Description |
---|---|
System.Boolean |
Get(Int32, Boolean)
Gets an UmbracoEntity by its Id, and optionally loads the complete object graph.
Declaration
IUmbracoEntity Get(int id, bool loadBaseType = true)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of the object to retrieve |
System.Boolean | loadBaseType | Optional bool to load the complete object graph when set to |
Returns
Type | Description |
---|---|
IUmbracoEntity | By default this will load the base type IUmbracoEntity with a minimum set of properties. |
Get(Int32, UmbracoObjectTypes, Boolean)
Gets an UmbracoEntity by its Id and UmbracoObjectType, and optionally loads the complete object graph.
Declaration
IUmbracoEntity Get(int id, UmbracoObjectTypes umbracoObjectType, bool loadBaseType = true)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of the object to retrieve |
UmbracoObjectTypes | umbracoObjectType | UmbracoObjectType of the entity to retrieve |
System.Boolean | loadBaseType | Optional bool to load the complete object graph when set to |
Returns
Type | Description |
---|---|
IUmbracoEntity | By default this will load the base type IUmbracoEntity with a minimum set of properties. |
Get<T>(Int32, Boolean)
Gets an UmbracoEntity by its Id and specified Type. Optionally loads the complete object graph.
Declaration
IUmbracoEntity Get<T>(int id, bool loadBaseType = true)where T : IUmbracoEntity
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of the object to retrieve |
System.Boolean | loadBaseType | Optional bool to load the complete object graph when set to |
Returns
Type | Description |
---|---|
IUmbracoEntity | By default this will load the base type IUmbracoEntity with a minimum set of properties. |
Type Parameters
Name | Description |
---|---|
T | Type of the model to retrieve. Must be based on an IUmbracoEntity |
GetAll(Guid, Int32[])
Gets a collection of IUmbracoEntity
Declaration
IEnumerable<IUmbracoEntity> GetAll(Guid objectTypeId, params int[] ids)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | objectTypeId | Guid id of the UmbracoObjectType |
System.Int32[] | ids |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IUmbracoEntity> | An enumerable list of IUmbracoEntity objects |
GetAll(UmbracoObjectTypes, Guid[])
Gets a collection of all IUmbracoEntity of a given type.
Declaration
IEnumerable<IUmbracoEntity> GetAll(UmbracoObjectTypes umbracoObjectType, Guid[] keys)
Parameters
Type | Name | Description |
---|---|---|
UmbracoObjectTypes | umbracoObjectType | UmbracoObjectType of the entities to return |
System.Guid[] | keys |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IUmbracoEntity> | An enumerable list of IUmbracoEntity objects |
GetAll(UmbracoObjectTypes, Int32[])
Gets a collection of all IUmbracoEntity of a given type.
Declaration
IEnumerable<IUmbracoEntity> GetAll(UmbracoObjectTypes umbracoObjectType, params int[] ids)
Parameters
Type | Name | Description |
---|---|---|
UmbracoObjectTypes | umbracoObjectType | UmbracoObjectType of the entities to return |
System.Int32[] | ids |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IUmbracoEntity> | An enumerable list of IUmbracoEntity objects |
GetAll<T>(Int32[])
Gets a collection of all IUmbracoEntity of a given type.
Declaration
IEnumerable<IUmbracoEntity> GetAll<T>(params int[] ids)where T : IUmbracoEntity
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | ids |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IUmbracoEntity> | An enumerable list of IUmbracoEntity objects |
Type Parameters
Name | Description |
---|---|
T | Type of the entities to retrieve |
GetAllPaths(UmbracoObjectTypes, Guid[])
Gets paths for entities.
Declaration
IEnumerable<EntityPath> GetAllPaths(UmbracoObjectTypes umbracoObjectType, params Guid[] keys)
Parameters
Type | Name | Description |
---|---|---|
UmbracoObjectTypes | umbracoObjectType | |
System.Guid[] | keys |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<EntityPath> |
GetAllPaths(UmbracoObjectTypes, Int32[])
Gets paths for entities.
Declaration
IEnumerable<EntityPath> GetAllPaths(UmbracoObjectTypes umbracoObjectType, params int[] ids)
Parameters
Type | Name | Description |
---|---|---|
UmbracoObjectTypes | umbracoObjectType | |
System.Int32[] | ids |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<EntityPath> |
GetByKey(Guid, Boolean)
Gets an UmbracoEntity by its Id, and optionally loads the complete object graph.
Declaration
IUmbracoEntity GetByKey(Guid key, bool loadBaseType = true)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | key | Unique Id of the object to retrieve |
System.Boolean | loadBaseType | Optional bool to load the complete object graph when set to |
Returns
Type | Description |
---|---|
IUmbracoEntity | By default this will load the base type IUmbracoEntity with a minimum set of properties. |
GetByKey(Guid, UmbracoObjectTypes, Boolean)
Gets an UmbracoEntity by its Id and UmbracoObjectType, and optionally loads the complete object graph.
Declaration
IUmbracoEntity GetByKey(Guid key, UmbracoObjectTypes umbracoObjectType, bool loadBaseType = true)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | key | Unique Id of the object to retrieve |
UmbracoObjectTypes | umbracoObjectType | UmbracoObjectType of the entity to retrieve |
System.Boolean | loadBaseType | Optional bool to load the complete object graph when set to |
Returns
Type | Description |
---|---|
IUmbracoEntity | By default this will load the base type IUmbracoEntity with a minimum set of properties. |
GetByKey<T>(Guid, Boolean)
Gets an UmbracoEntity by its Id and specified Type. Optionally loads the complete object graph.
Declaration
IUmbracoEntity GetByKey<T>(Guid key, bool loadBaseType = true)where T : IUmbracoEntity
Parameters
Type | Name | Description |
---|---|---|
System.Guid | key | Unique Id of the object to retrieve |
System.Boolean | loadBaseType | Optional bool to load the complete object graph when set to |
Returns
Type | Description |
---|---|
IUmbracoEntity | By default this will load the base type IUmbracoEntity with a minimum set of properties. |
Type Parameters
Name | Description |
---|---|
T | Type of the model to retrieve. Must be based on an IUmbracoEntity |
GetChildren(Int32)
Gets a collection of children by the parents Id
Declaration
IEnumerable<IUmbracoEntity> GetChildren(int parentId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | parentId | Id of the parent to retrieve children for |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IUmbracoEntity> | An enumerable list of IUmbracoEntity objects |
GetChildren(Int32, UmbracoObjectTypes)
Gets a collection of children by the parents Id and UmbracoObjectType
Declaration
IEnumerable<IUmbracoEntity> GetChildren(int parentId, UmbracoObjectTypes umbracoObjectType)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | parentId | Id of the parent to retrieve children for |
UmbracoObjectTypes | umbracoObjectType | UmbracoObjectType of the children to retrieve |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IUmbracoEntity> | An enumerable list of IUmbracoEntity objects |
GetDescendents(Int32)
Gets a collection of descendents by the parents Id
Declaration
IEnumerable<IUmbracoEntity> GetDescendents(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of entity to retrieve descendents for |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IUmbracoEntity> | An enumerable list of IUmbracoEntity objects |
GetDescendents(Int32, UmbracoObjectTypes)
Gets a collection of descendents by the parents Id
Declaration
IEnumerable<IUmbracoEntity> GetDescendents(int id, UmbracoObjectTypes umbracoObjectType)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of entity to retrieve descendents for |
UmbracoObjectTypes | umbracoObjectType | UmbracoObjectType of the descendents to retrieve |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IUmbracoEntity> | An enumerable list of IUmbracoEntity objects |
GetEntityType(Int32)
Gets the Type of an entity by its Id
Declaration
Type GetEntityType(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of the entity |
Returns
Type | Description |
---|---|
System.Type | Type of the entity |
GetEntityType(UmbracoObjectTypes)
Gets the Type of an entity by its UmbracoObjectTypes
Declaration
Type GetEntityType(UmbracoObjectTypes umbracoObjectType)
Parameters
Type | Name | Description |
---|---|---|
UmbracoObjectTypes | umbracoObjectType | UmbracoObjectTypes |
Returns
Type | Description |
---|---|
System.Type | Type of the entity |
GetIdForKey(Guid, UmbracoObjectTypes)
Returns the integer id for a given GUID
Declaration
Attempt<int> GetIdForKey(Guid key, UmbracoObjectTypes umbracoObjectType)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | key | |
UmbracoObjectTypes | umbracoObjectType |
Returns
Type | Description |
---|---|
Attempt<System.Int32> |
GetIdForUdi(Udi)
Returns the integer id for a given Udi
Declaration
Attempt<int> GetIdForUdi(Udi udi)
Parameters
Type | Name | Description |
---|---|---|
Udi | udi |
Returns
Type | Description |
---|---|
Attempt<System.Int32> |
GetKeyForId(Int32, UmbracoObjectTypes)
Returns the GUID for a given integer id
Declaration
Attempt<Guid> GetKeyForId(int id, UmbracoObjectTypes umbracoObjectType)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | |
UmbracoObjectTypes | umbracoObjectType |
Returns
Type | Description |
---|---|
Attempt<System.Guid> |
GetObjectType(Int32)
Gets the UmbracoObjectType from the integer id of an IUmbracoEntity.
Declaration
UmbracoObjectTypes GetObjectType(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of the entity |
Returns
Type | Description |
---|---|
UmbracoObjectTypes | UmbracoObjectTypes |
GetObjectType(IUmbracoEntity)
Gets the UmbracoObjectType from an IUmbracoEntity.
Declaration
UmbracoObjectTypes GetObjectType(IUmbracoEntity entity)
Parameters
Type | Name | Description |
---|---|---|
IUmbracoEntity | entity | IUmbracoEntity |
Returns
Type | Description |
---|---|
UmbracoObjectTypes | UmbracoObjectTypes |
GetPagedChildren(Int32, UmbracoObjectTypes, Int64, Int32, out Int64, String, Direction, String)
Returns a paged collection of children
Declaration
IEnumerable<IUmbracoEntity> GetPagedChildren(int parentId, UmbracoObjectTypes umbracoObjectType, long pageIndex, int pageSize, out long totalRecords, string orderBy = "SortOrder", Direction orderDirection = Direction.Ascending, string filter = "")
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | parentId | The parent id to return children for |
UmbracoObjectTypes | umbracoObjectType | |
System.Int64 | pageIndex | |
System.Int32 | pageSize | |
System.Int64 | totalRecords | |
System.String | orderBy | |
Direction | orderDirection | |
System.String | filter |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IUmbracoEntity> |
GetPagedDescendants(IEnumerable<Int32>, UmbracoObjectTypes, Int64, Int32, out Int64, String, Direction, String)
Returns a paged collection of descendants
Declaration
IEnumerable<IUmbracoEntity> GetPagedDescendants(IEnumerable<int> ids, UmbracoObjectTypes umbracoObjectType, long pageIndex, int pageSize, out long totalRecords, string orderBy = "path", Direction orderDirection = Direction.Ascending, string filter = "")
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Int32> | ids | |
UmbracoObjectTypes | umbracoObjectType | |
System.Int64 | pageIndex | |
System.Int32 | pageSize | |
System.Int64 | totalRecords | |
System.String | orderBy | |
Direction | orderDirection | |
System.String | filter |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IUmbracoEntity> |
GetPagedDescendants(Int32, UmbracoObjectTypes, Int64, Int32, out Int64, String, Direction, String)
Returns a paged collection of descendants
Declaration
IEnumerable<IUmbracoEntity> GetPagedDescendants(int id, UmbracoObjectTypes umbracoObjectType, long pageIndex, int pageSize, out long totalRecords, string orderBy = "path", Direction orderDirection = Direction.Ascending, string filter = "")
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | |
UmbracoObjectTypes | umbracoObjectType | |
System.Int64 | pageIndex | |
System.Int32 | pageSize | |
System.Int64 | totalRecords | |
System.String | orderBy | |
Direction | orderDirection | |
System.String | filter |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IUmbracoEntity> |
GetPagedDescendantsFromRoot(UmbracoObjectTypes, Int64, Int32, out Int64, String, Direction, String, Boolean)
Returns a paged collection of descendants from the root
Declaration
IEnumerable<IUmbracoEntity> GetPagedDescendantsFromRoot(UmbracoObjectTypes umbracoObjectType, long pageIndex, int pageSize, out long totalRecords, string orderBy = "path", Direction orderDirection = Direction.Ascending, string filter = "", bool includeTrashed = true)
Parameters
Type | Name | Description |
---|---|---|
UmbracoObjectTypes | umbracoObjectType | |
System.Int64 | pageIndex | |
System.Int32 | pageSize | |
System.Int64 | totalRecords | |
System.String | orderBy | |
Direction | orderDirection | |
System.String | filter | |
System.Boolean | includeTrashed | true/false to include trashed objects |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IUmbracoEntity> |
GetParent(Int32)
Gets the parent of entity by its id
Declaration
IUmbracoEntity GetParent(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of the entity to retrieve the Parent for |
Returns
Type | Description |
---|---|
IUmbracoEntity |
GetParent(Int32, UmbracoObjectTypes)
Gets the parent of entity by its id and UmbracoObjectType
Declaration
IUmbracoEntity GetParent(int id, UmbracoObjectTypes umbracoObjectType)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of the entity to retrieve the Parent for |
UmbracoObjectTypes | umbracoObjectType | UmbracoObjectType of the parent to retrieve |
Returns
Type | Description |
---|---|
IUmbracoEntity |
GetRootEntities(UmbracoObjectTypes)
Gets a collection of the entities at the root, which corresponds to the entities with a Parent Id of -1.
Declaration
IEnumerable<IUmbracoEntity> GetRootEntities(UmbracoObjectTypes umbracoObjectType)
Parameters
Type | Name | Description |
---|---|---|
UmbracoObjectTypes | umbracoObjectType | UmbracoObjectType of the root entities to retrieve |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IUmbracoEntity> | An enumerable list of IUmbracoEntity objects |
ReserveId(Guid)
Reserves an identifier for a key.
Declaration
int ReserveId(Guid key)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | key | They key. |
Returns
Type | Description |
---|---|
System.Int32 | The identifier. |
Remarks
When a new content or a media is saved with the key, it will have the reserved identifier.