System.Object
Namespace: Umbraco.Cms.Core.Services Assembly: Umbraco.Core.dll Syntaxpublic class TemplateService : RepositoryService, ITemplateService, IService
Constructors View Source TemplateService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IShortStringHelper, ITemplateRepository, IAuditRepository, ITemplateContentParserService, IUserIdKeyResolver, IDefaultViewContentProvider) Declaration
public TemplateService(ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IShortStringHelper shortStringHelper, ITemplateRepository templateRepository, IAuditRepository auditRepository, ITemplateContentParserService templateContentParserService, IUserIdKeyResolver userIdKeyResolver, IDefaultViewContentProvider defaultViewContentProvider)
Parameters Methods View Source CreateAsync(String, String, String, Guid, Nullable<Guid>)
Creates a new template
Declarationpublic async Task<Attempt<ITemplate, TemplateOperationStatus>> CreateAsync(string name, string alias, string content, Guid userKey, Guid? templateKey = null)
Parameters Type Name Description System.String name
Name of the new template
System.String aliasAlias of the template
System.String contentView content for the new template
Guid userKeyKey of the user performing the Create.
System.Nullable<Guid> templateKey Returns View Source CreateAsync(ITemplate, Guid)Creates a new template
Declarationpublic async Task<Attempt<ITemplate, TemplateOperationStatus>> CreateAsync(ITemplate template, Guid userKey)
Parameters Type Name Description ITemplate template
The new template
Guid userKeyKey of the user performing the Create.
Returns View Source CreateForContentTypeAsync(String, String, Guid)Creates a template for a content type
Declarationpublic async Task<Attempt<ITemplate, TemplateOperationStatus>> CreateForContentTypeAsync(string contentTypeAlias, string contentTypeName, Guid userKey)
Parameters Type Name Description System.String contentTypeAlias System.String contentTypeName Guid userKey
Key of the user performing the Create.
Returns View Source DeleteAsync(Guid, Guid)Deletes a template by its key
Declarationpublic async Task<Attempt<ITemplate, TemplateOperationStatus>> DeleteAsync(Guid key, Guid userKey)
Parameters Type Name Description Guid key
Key of the ITemplate to delete
Guid userKeyKey of the user performing the Delete.
Returns View Source DeleteAsync(String, Guid)Deletes a template by its alias
Declarationpublic async Task<Attempt<ITemplate, TemplateOperationStatus>> DeleteAsync(string alias, Guid userKey)
Parameters Type Name Description System.String alias
Alias of the ITemplate to delete
Guid userKeyKey of the user performing the Delete.
Returns View Source GetAllAsync(Guid[])Gets a list of all ITemplate objects
Declarationpublic Task<IEnumerable<ITemplate>> GetAllAsync(params Guid[] keys)
Parameters Type Name Description Guid[] keys Returns View Source GetAllAsync(String[])
Gets a list of all ITemplate objects
Declarationpublic async Task<IEnumerable<ITemplate>> GetAllAsync(params string[] aliases)
Parameters Type Name Description System.String[] aliases Returns View Source GetAsync(Guid)
Gets a ITemplate object by its guid identifier.
Declarationpublic async Task<ITemplate> GetAsync(Guid id)
Parameters Type Name Description Guid id
The guid identifier of the template.
Returns View Source GetAsync(Int32)Gets a ITemplate object by its identifier.
Declarationpublic async Task<ITemplate> GetAsync(int id)
Parameters Type Name Description System.Int32 id
The identifier of the template.
Returns View Source GetAsync(String)Gets a ITemplate object by its alias.
Declarationpublic async Task<ITemplate> GetAsync(string alias)
Parameters Type Name Description System.String alias
The alias of the template.
Returns View Source GetChildrenAsync(Int32)Gets a list of all ITemplate objects
Declarationpublic async Task<IEnumerable<ITemplate>> GetChildrenAsync(int masterTemplateId)
Parameters Type Name Description System.Int32 masterTemplateId Returns View Source GetDescendantsAsync(Int32)
Gets the template descendants
Declarationpublic async Task<IEnumerable<ITemplate>> GetDescendantsAsync(int masterTemplateId)
Parameters Type Name Description System.Int32 masterTemplateId Returns Type Description Task<IEnumerable<ITemplate>> View Source GetFileContentStreamAsync(String)
Gets the content of a template as a stream.
Declarationpublic async Task<Stream> GetFileContentStreamAsync(string filepath)
Parameters Type Name Description System.String filepath
The filesystem path to the template.
Returns Type Description Task<Stream>The content of the template.
View Source GetFileSizeAsync(String)Gets the size of a template.
Declarationpublic async Task<long> GetFileSizeAsync(string filepath)
Parameters Type Name Description System.String filepath
The filesystem path to the template.
Returns Type Description Task<System.Int64>The size of the template.
View Source SetFileContentAsync(String, Stream)Sets the content of a template.
Declarationpublic async Task SetFileContentAsync(string filepath, Stream content)
Parameters Type Name Description System.String filepath
The filesystem path to the template.
Stream contentThe content of the template.
Returns View Source UpdateAsync(ITemplate, Guid)Updates a ITemplate
Declarationpublic async Task<Attempt<ITemplate, TemplateOperationStatus>> UpdateAsync(ITemplate template, Guid userKey)
Parameters Type Name Description ITemplate template
ITemplate to update
Guid userKeyKey of the user saving the template
ReturnsRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4