Class AppTemplateService
Represents a service for managing templates.
Implements
Inherited Members
Namespace: DataWeb.Templating
Assembly: DataWeb.Core.dll
Syntax
public class AppTemplateService : IAppTemplateService
Remarks
Initializes a new instance of the AppTemplateService class.
Constructors
AppTemplateService(IAppTemplateStore, IFileService)
Represents a service for managing templates.
Declaration
public AppTemplateService(IAppTemplateStore appTemplateStore, IFileService fileService)
Parameters
| Type | Name | Description |
|---|---|---|
| IAppTemplateStore | appTemplateStore | The template store to use for retrieving and saving templates. |
| IFileService | fileService | The file service for file retrieving. |
Remarks
Initializes a new instance of the AppTemplateService class.
Methods
GetAppTemplateAsync(string, string, CancellationToken)
Gets a template matching the specified filter.
Declaration
public Task<AppTemplate> GetAppTemplateAsync(string name, string culture = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name to apply to the templates. |
| string | culture | The culture for version filtering. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<AppTemplate> | The template matching the specified name, or null if no match was found. |
GetAppTemplateContextsAsync(string, CancellationToken)
Gets all the distinct template contexts in the system.
Declaration
public Task<IEnumerable<string>> GetAppTemplateContextsAsync(string culture = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | culture | The culture for version filtering. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<string>> | A list of all the distinct template contexts in the system. |
GetAppTemplateCountAsync(AppTemplateFilter, string, CancellationToken)
Gets the count of templates matching the specified filter.
Declaration
public Task<long> GetAppTemplateCountAsync(AppTemplateFilter filter, string culture = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| AppTemplateFilter | filter | The AppTemplateFilter to apply to the templates. |
| string | culture | The culture for version filtering. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<long> | The count of templates matching the specified filter. |
GetAppTemplatesAsync(AppTemplateFilter, string, CancellationToken)
Gets the templates matching the specified filter.
Declaration
public Task<IEnumerable<AppTemplate>> GetAppTemplatesAsync(AppTemplateFilter filter, string culture = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| AppTemplateFilter | filter | The AppTemplateFilter to apply to the templates. |
| string | culture | The culture for version filtering. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<AppTemplate>> | The templates matching the specified filter. |
GetContextAppTemplatesAsync(string, string, CancellationToken)
Retrieves all templates from cache.
Declaration
public Task<IEnumerable<AppTemplate>> GetContextAppTemplatesAsync(string templateContext, string culture = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | templateContext | The template context. |
| string | culture | The culture for version filtering. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<AppTemplate>> | An IEnumerable<T> of AppTemplate objects. |
GetImageCachedAsync(string, string, CancellationToken)
Gets a template image that matches the specified filter.
Declaration
public Task<File> GetImageCachedAsync(string code, string culture = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | code | The code of the image. |
| string | culture | The culture for version filtering. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<File> | The cached image that matches the specified code. |