Interface IPackageDataInstallation
Defines the PackageDataInstallation service, which provides operations for installing package data such as content types, data types, dictionary items, languages, and templates.
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public interface IPackageDataInstallation
Methods
View SourceGetContentTypeKey(XElement)
Gets the content type key from an XML element representing a content type.
Declaration
Guid GetContentTypeKey(XElement contentType)
Parameters
| Type | Name | Description |
|---|---|---|
| XElement | contentType | The XML element representing the content type. |
Returns
| Type | Description |
|---|---|
| Guid | The System.Guid key of the content type. |
GetEntityTypeAlias(XElement)
Gets the entity type alias from an XML element.
Declaration
string? GetEntityTypeAlias(XElement entityType)
Parameters
| Type | Name | Description |
|---|---|---|
| XElement | entityType | The XML element representing the entity type. |
Returns
| Type | Description |
|---|---|
| string | The alias of the entity type, or |
ImportContentBase<TContentBase, TContentTypeComposition>(IEnumerable<CompiledPackageContentBase>, IDictionary<string, TContentTypeComposition>, int, IContentTypeBaseService<TContentTypeComposition>, IContentServiceBase<TContentBase>)
Imports and saves content base items from a compiled package.
Declaration
IReadOnlyList<TContentBase> ImportContentBase<TContentBase, TContentTypeComposition>(IEnumerable<CompiledPackageContentBase> docs, IDictionary<string, TContentTypeComposition> importedDocumentTypes, int userId, IContentTypeBaseService<TContentTypeComposition> typeService, IContentServiceBase<TContentBase> service) where TContentBase : class, IContentBase where TContentTypeComposition : IContentTypeComposition
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<CompiledPackageContentBase> | docs | The compiled package content base items to import. |
| IDictionary<string, TContentTypeComposition> | importedDocumentTypes | A dictionary of imported document types keyed by their alias. |
| int | userId | The id of the user performing the import. |
| IContentTypeBaseService<TContentTypeComposition> | typeService | The service for managing content types. |
| IContentServiceBase<TContentBase> | service | The service for managing content. |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<TContentBase> | A read-only list of imported content base items. |
Type Parameters
| Name | Description |
|---|---|
| TContentBase | The type of content base being imported (e.g., IContent or IMedia). |
| TContentTypeComposition | The type of content type composition. |
ImportDataTypes(IReadOnlyCollection<XElement>, int)
Imports and saves package xml as IDataType
Declaration
IReadOnlyList<IDataType> ImportDataTypes(IReadOnlyCollection<XElement> dataTypeElements, int userId)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyCollection<XElement> | dataTypeElements | Xml to import |
| int | userId | Optional id of the user |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<IDataType> | An enumerable list of generated DataTypeDefinitions |
ImportDictionaryItem(XElement, int, Guid?)
Imports a single dictionary item and its children from an System.Xml.Linq.XElement.
Declaration
IEnumerable<IDictionaryItem> ImportDictionaryItem(XElement dictionaryItemElement, int userId, Guid? parentId)
Parameters
| Type | Name | Description |
|---|---|---|
| XElement | dictionaryItemElement | The XML element representing the dictionary item. |
| int | userId | The id of the user performing the import. |
| Guid? | parentId | The optional parent id for the dictionary item. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IDictionaryItem> | An enumerable collection of imported IDictionaryItem objects. |
ImportDictionaryItems(IEnumerable<XElement>, int)
Imports and saves the 'DictionaryItems' part of the package xml as a list of IDictionaryItem
Declaration
IReadOnlyList<IDictionaryItem> ImportDictionaryItems(IEnumerable<XElement> dictionaryItemElementList, int userId)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<XElement> | dictionaryItemElementList | Xml to import |
| int | userId | The id of the user performing the import. |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<IDictionaryItem> | An enumerable list of dictionary items |
ImportDocumentType(XElement, int)
Imports and saves a single document type from an System.Xml.Linq.XElement.
Declaration
IReadOnlyList<IContentType> ImportDocumentType(XElement docTypeElement, int userId)
Parameters
| Type | Name | Description |
|---|---|---|
| XElement | docTypeElement | The XML element representing the document type. |
| int | userId | The id of the user performing the import. |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<IContentType> | A read-only list of imported IContentType objects. |
ImportDocumentTypes(IEnumerable<XElement>, int)
Imports and saves package xml as IContentType
Declaration
IReadOnlyList<IContentType> ImportDocumentTypes(IEnumerable<XElement> docTypeElements, int userId)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<XElement> | docTypeElements | Xml to import |
| int | userId | Optional id of the User performing the operation. Default is zero (admin). |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<IContentType> | An enumerable list of generated ContentTypes |
ImportLanguages(IEnumerable<XElement>, int)
Imports and saves the 'Languages' part of a package xml as a list of ILanguage
Declaration
IReadOnlyList<ILanguage> ImportLanguages(IEnumerable<XElement> languageElements, int userId)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<XElement> | languageElements | Xml to import |
| int | userId | Optional id of the User performing the operation |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<ILanguage> | An enumerable list of generated languages |
ImportMediaTypes(IEnumerable<XElement>, int)
Imports and saves package xml as IMediaType.
Declaration
IReadOnlyList<IMediaType> ImportMediaTypes(IEnumerable<XElement> docTypeElements, int userId)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<XElement> | docTypeElements | Xml to import |
| int | userId | Optional id of the User performing the operation. Default is zero (admin). |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<IMediaType> | An enumerable list of generated IMediaTypes. |
ImportMemberTypes(IEnumerable<XElement>, int)
Imports and saves package xml as IMemberType.
Declaration
IReadOnlyList<IMemberType> ImportMemberTypes(IEnumerable<XElement> docTypeElements, int userId)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<XElement> | docTypeElements | Xml to import |
| int | userId | Optional id of the User performing the operation. Default is zero (admin). |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<IMemberType> | An enumerable list of generated IMemberTypes. |
ImportTemplateAsync(XElement, int)
Imports a single template from an System.Xml.Linq.XElement asynchronously.
Declaration
Task<IEnumerable<ITemplate>> ImportTemplateAsync(XElement templateElement, int userId)
Parameters
| Type | Name | Description |
|---|---|---|
| XElement | templateElement | The XML element representing the template. |
| int | userId | The id of the user performing the import. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<ITemplate>> | An enumerable collection of imported ITemplate objects. |
ImportTemplatesAsync(IReadOnlyCollection<XElement>, int)
Imports and saves package xml as ITemplate
Declaration
Task<IReadOnlyList<ITemplate>> ImportTemplatesAsync(IReadOnlyCollection<XElement> templateElements, int userId)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyCollection<XElement> | templateElements | Xml to import |
| int | userId | Optional user id |
Returns
| Type | Description |
|---|---|
| Task<IReadOnlyList<ITemplate>> | An enumerable list of generated Templates |
InstallPackageData(CompiledPackage, int)
Installs the data from a compiled package.
Declaration
InstallationSummary InstallPackageData(CompiledPackage compiledPackage, int userId)
Parameters
| Type | Name | Description |
|---|---|---|
| CompiledPackage | compiledPackage | The compiled package containing the data to install. |
| int | userId | The id of the user performing the installation. |
Returns
| Type | Description |
|---|---|
| InstallationSummary | An InstallationSummary containing the results of the installation. |