Class AppTemplateStore
Manages application templates in SQL Server with caching support.
Implements
Inherited Members
Namespace: DataWeb.Templating.SqlServer
Assembly: DataWeb.Data.SqlServer.dll
Syntax
public class AppTemplateStore : IAppTemplateStore
Constructors
AppTemplateStore(ISqlHelper, ICacheService)
Manages application templates in SQL Server with caching support.
Declaration
public AppTemplateStore(ISqlHelper sqlHelper, ICacheService cacheService)
Parameters
| Type | Name | Description |
|---|---|---|
| ISqlHelper | sqlHelper | |
| ICacheService | cacheService |
Properties
Name
Gets the name of the template store.
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
GetAppTemplateAsync(AppTemplateFilter, string, CancellationToken)
Retrieves a single application template matching the specified filter criteria.
Declaration
public Task<AppTemplate> GetAppTemplateAsync(AppTemplateFilter filter, string culture, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| AppTemplateFilter | filter | The filter criteria for the template. |
| string | culture | The culture for localization. |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<AppTemplate> | The first template matching the filter, or null if no match found. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when filter is null. |
GetAppTemplateCachedAsync(string, string, CancellationToken)
Retrieves a cached application template by name.
Declaration
public Task<AppTemplate> GetAppTemplateCachedAsync(string name, string culture = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the template to retrieve. |
| string | culture | Optional culture for localization. |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<AppTemplate> | The cached template, or null if not found. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when name is null or empty. |
GetAppTemplateContextsAsync(string, CancellationToken)
Retrieves all available template contexts.
Declaration
public Task<IEnumerable<string>> GetAppTemplateContextsAsync(string culture = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | culture | Optional culture for localization. |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<string>> | A collection of unique template context identifiers. |
GetAppTemplateContextsCachedAsync(string, CancellationToken)
Retrieves all available template contexts with caching.
Declaration
public Task<IEnumerable<string>> GetAppTemplateContextsCachedAsync(string culture = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | culture | Optional culture for localization. |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<string>> | A cached collection of unique template context identifiers. |
GetAppTemplateCountAsync(AppTemplateFilter, string, CancellationToken)
Gets the count of application templates matching the specified filter criteria.
Declaration
public Task<long> GetAppTemplateCountAsync(AppTemplateFilter filter, string culture = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| AppTemplateFilter | filter | The filter criteria for templates. |
| string | culture | Optional culture for localization. |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<long> | The count of templates matching the filter. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when filter is null. |
GetAppTemplatesAsync(AppTemplateFilter, string, CancellationToken)
Retrieves application templates matching the specified filter criteria.
Declaration
public Task<IEnumerable<AppTemplate>> GetAppTemplatesAsync(AppTemplateFilter filter, string culture = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| AppTemplateFilter | filter | The filter criteria for templates. |
| string | culture | Optional culture for localization. |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<AppTemplate>> | A collection of application templates matching the filter. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when filter is null. |
GetContextAppTemplatesCachedAsync(string, string, CancellationToken)
Retrieves application templates for a specific context with caching.
Declaration
public Task<IEnumerable<AppTemplate>> GetContextAppTemplatesCachedAsync(string templateContext, string culture = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | templateContext | The template context identifier. |
| string | culture | Optional culture for localization. |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<AppTemplate>> | A cached collection of templates for the specified context. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when templateContext is null or empty. |
GetImageAsync(AppTemplateFileFilter, string, CancellationToken)
Retrieves a single image associated with application templates.
Declaration
public Task<FileData> GetImageAsync(AppTemplateFileFilter filter, string culture = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| AppTemplateFileFilter | filter | The filter criteria for the image. |
| string | culture | Optional culture for localization. |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<FileData> | The first image file data matching the filter, or null if no match found. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when filter is null. |
GetImageCachedAsync(string, string, CancellationToken)
Retrieves a cached image by code.
Declaration
public Task<FileData> GetImageCachedAsync(string code, string culture = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | code | The image code identifier. |
| string | culture | Optional culture for localization. |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<FileData> | The cached file data for the image, or null if not found. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when code is null or empty. |
GetImagesAsync(AppTemplateFileFilter, string, CancellationToken)
Retrieves images associated with application templates.
Declaration
public Task<IEnumerable<FileData>> GetImagesAsync(AppTemplateFileFilter filter, string culture = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| AppTemplateFileFilter | filter | The filter criteria for images. |
| string | culture | Optional culture for localization. |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<FileData>> | A collection of file data for template images. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when filter is null. |