Class FormStore
Implements
Inherited Members
Namespace: DataWeb.Data.SqlServer
Assembly: DataWeb.Data.SqlServer.dll
Syntax
public class FormStore : IFormStore
Constructors
FormStore(ISqlHelper, ICacheService)
Declaration
public FormStore(ISqlHelper sqlHelper, ICacheService cacheService)
Parameters
| Type | Name | Description |
|---|---|---|
| ISqlHelper | sqlHelper | |
| ICacheService | cacheService |
Properties
Name
Gets the name of the store implementation.
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
GetFormAsync(FormFilter, string, CancellationToken)
Retrieves the first form matching the specified filter with localized control titles, or null if none is found.
Declaration
public Task<FormData> GetFormAsync(FormFilter filter, string culture, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| FormFilter | filter | The filter criteria used to query the form. |
| string | culture | The culture code for form localization (e.g., "en-US"). |
| CancellationToken | cancellationToken | A token to cancel the asynchronous operation. |
Returns
| Type | Description |
|---|---|
| Task<FormData> |
GetFormCachedAsync(string, string, CancellationToken)
Retrieves a form by name with localized control titles, using the cache when available.
Declaration
public Task<FormData> GetFormCachedAsync(string name, string culture, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the form to retrieve. |
| string | culture | The culture code for form localization (e.g., "en-US"). |
| CancellationToken | cancellationToken | A token to cancel the asynchronous operation. |
Returns
| Type | Description |
|---|---|
| Task<FormData> | The cached or freshly loaded FormData, or null if not found. |
GetFormsAsync(FormFilter, string, CancellationToken)
Retrieves a collection of forms matching the specified filter with localized control titles.
Declaration
public Task<IEnumerable<FormData>> GetFormsAsync(FormFilter filter, string culture, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| FormFilter | filter | The filter criteria used to query forms. |
| string | culture | The culture code for form localization (e.g., "en-US"). |
| CancellationToken | cancellationToken | A token to cancel the asynchronous operation. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<FormData>> | A collection of FormData matching the filter. |
GetSubFieldValue(string, object)
Extracts a sub-field value from a JSON-serialized field value.
Declaration
public object GetSubFieldValue(string subField, object fieldValue)
Parameters
| Type | Name | Description |
|---|---|---|
| string | subField | The name of the sub-field to extract. |
| object | fieldValue | The JSON-serialized field value. |
Returns
| Type | Description |
|---|---|
| object | The sub-field value, or null if not found. |
ParseAllStructuredData(string)
Parses JSON-serialized data and returns its root element.
Declaration
public object ParseAllStructuredData(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The JSON-serialized data. |
Returns
| Type | Description |
|---|---|
| object | The root JsonElement, or null if |
ParseCurrentStructuredData(string)
Parses JSON-serialized structured data into a list of dictionaries.
Declaration
public List<Dictionary<string, object>> ParseCurrentStructuredData(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The JSON-serialized structured data. Can be an array or a single object. |
Returns
| Type | Description |
|---|---|
| List<Dictionary<string, object>> | A list of dictionaries, one per array element or object. |
SerializeStructuredData(object)
Serializes an object to a JSON string representation of structured data.
Declaration
public string SerializeStructuredData(object value)
Parameters
| Type | Name | Description |
|---|---|---|
| object | value | The object to serialize. |
Returns
| Type | Description |
|---|---|
| string | The JSON-serialized representation. |