Class ViewStore
Manages view data in SQL Server with caching support.
Implements
Inherited Members
Namespace: DataWeb.Structure.SqlServer
Assembly: DataWeb.Data.SqlServer.dll
Syntax
public class ViewStore : IViewStore
Constructors
ViewStore(ISqlHelper, ICacheService)
Manages view data in SQL Server with caching support.
Declaration
public ViewStore(ISqlHelper sqlHelper, ICacheService cacheService)
Parameters
| Type | Name | Description |
|---|---|---|
| ISqlHelper | sqlHelper | |
| ICacheService | cacheService |
Properties
Name
The name of the view store.
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
GetSectionViewsCachedAsync(string, PublishMode, CancellationToken)
Retrieves views for a specific section with caching.
Declaration
public Task<IEnumerable<ViewData>> GetSectionViewsCachedAsync(string sectionIdMaster, PublishMode publishMode = PublishMode.Preview, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sectionIdMaster | The section ID master identifier. |
| PublishMode | publishMode | The publish mode to filter by. Defaults to Preview. |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<ViewData>> | A cached collection of views for the specified section. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when sectionIdMaster is null or empty. |
GetViewAsync(ViewFilter, CancellationToken)
Retrieves a single view matching the specified filter criteria.
Declaration
public Task<ViewData> GetViewAsync(ViewFilter filter, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| ViewFilter | filter | The filter criteria for the view. |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<ViewData> | The first view matching the filter, or null if no match found. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when filter is null. |
GetViewCachedAsync(string, CancellationToken)
Retrieves a cached view by name.
Declaration
public Task<ViewData> GetViewCachedAsync(string name, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the view to retrieve. |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<ViewData> | The cached view, or null if not found. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when name is null or empty. |
GetViewsAsync(ViewFilter, CancellationToken)
Retrieves views matching the specified filter criteria.
Declaration
public Task<IEnumerable<ViewData>> GetViewsAsync(ViewFilter filter, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| ViewFilter | filter | The filter criteria for views. |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<ViewData>> | A collection of views matching the filter. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when filter is null. |
GetViewsCachedAsync(PublishMode, CancellationToken)
Retrieves all views with caching, optionally filtered by publish mode.
Declaration
public Task<IEnumerable<ViewData>> GetViewsCachedAsync(PublishMode publishMode = PublishMode.Preview, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| PublishMode | publishMode | The publish mode to filter by. Defaults to Preview. |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<ViewData>> | A cached collection of views. |