Interface IFormStore
Defines the data-access contract for loading, parsing, and serializing form definitions.
Namespace: DataWeb.Data
Assembly: DataWeb.Core.dll
Syntax
public interface IFormStore
Properties
Name
Gets the name of the store implementation (e.g. "SqlServer").
Declaration
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
Task<FormData> GetFormAsync(FormFilter filter, string culture, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| FormFilter | filter | The filter criteria used to query the form. Must not be |
| string | culture | The culture code for form localization (e.g. |
| CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
| Type | Description |
|---|---|
| Task<FormData> |
GetFormCachedAsync(string, string, CancellationToken)
Retrieves a form by name with localized control titles, using the cache when available.
Declaration
Task<FormData> GetFormCachedAsync(string name, string culture, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the form to retrieve. Must not be null or empty. |
| string | culture | The culture code for form localization (e.g. |
| CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
| Type | Description |
|---|---|
| Task<FormData> | A task that returns 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
Task<IEnumerable<FormData>> GetFormsAsync(FormFilter filter, string culture, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| FormFilter | filter | The filter criteria used to query forms. Must not be |
| string | culture | The culture code for form localization (e.g. |
| CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<FormData>> | A task that returns the collection of FormData objects matching the filter. |
GetSubFieldValue(string, object)
Extracts a sub-field value from a JSON-serialized field value.
Declaration
object GetSubFieldValue(string subField, object fieldValue)
Parameters
| Type | Name | Description |
|---|---|---|
| string | subField | The name of the sub-field to extract. Must not be null or empty. |
| object | fieldValue | The JSON-serialized field value that contains the sub-field. |
Returns
| Type | Description |
|---|---|
| object | The sub-field value, or null if not found or if |
ParseAllStructuredData(string)
Parses JSON-serialized data and returns its root element as a native object. Arrays are returned as List<T> of Dictionary<TKey, TValue>, objects as a single Dictionary<TKey, TValue>, and scalar values as their CLR equivalent.
Declaration
object ParseAllStructuredData(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The JSON-serialized data to parse. |
Returns
| Type | Description |
|---|---|
| object | The parsed object, or null if |
ParseCurrentStructuredData(string)
Parses JSON-serialized structured data into a list of dictionaries. Supports both JSON arrays (one dictionary per element) and single JSON objects.
Declaration
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 case-insensitive dictionaries, one per array element or object. Returns an empty list when |
SerializeStructuredData(object)
Serializes an object to a JSON string representation of structured data.
Declaration
string SerializeStructuredData(object value)
Parameters
| Type | Name | Description |
|---|---|---|
| object | value | The object to serialize. |
Returns
| Type | Description |
|---|---|
| string | The JSON-serialized string representation. |