1. Stylelabs.M.Sdk.Clients

Interface IDataSourcesClient

Provides functionality to query, create and manipulate datasources.

Namespace: StylelabsStylelabs.MSdkClients

Assembly: Stylelabs.M.Sdk.dll

Syntax

public interface IDataSourcesClient

Methods

CreateAsync(IDataSource)

Creates a new datasource.

Declaration

Task CreateAsync(IDataSource dataSource)

Parameters

TypeNameDescription
IDataSourcedataSourceThe datasource to create.

Returns

TypeDescription
TaskA representing the asynchronous operation.

Exceptions

TypeCondition
ValidationExceptionThrown when the datasource could not be created because it is not valid. Common cases
name of the datasource is invalid.The datasource contains hierarchical values but has type "Flat".A datasource with the specified name already exists.Not all values have an identifier.The identifiers of the values are not unique.
ForbiddenExceptionThrown when the user is not allowed to create datasources.

DeleteAsync(string)

Deletes the datasource with the specified name.

Declaration

Task DeleteAsync(string name)

Parameters

TypeNameDescription
stringnameThe name of the datasource to delete (case insensitive).

Returns

TypeDescription
TaskA representing the asynchronous operation.

Exceptions

TypeCondition
ForbiddenExceptionThrown when the user is not allowed to delete the datasource.
ValidationExceptionThrown when the datasource could not be deleted because a validation error occurred. Common case: the datasource is being used in one or more EntityDefinitions.

GetAllAsync()

Gets the names of all datasources that exist in the M.

Declaration

Task<IList<string>> GetAllAsync()

Returns

TypeDescription
Task<>IList<>stringThe names of all datasources that exist in M.

GetAsync(string)

Gets the datasource with the specified name.

Declaration

Task<IDataSource> GetAsync(string name)

Parameters

TypeNameDescription
stringnameThe name of the datasource to get (case insensitive).

Returns

TypeDescription
Task<>IDataSourceThe datasource with the specified name or null if the datasource could not be found.

GetManyAsync(IEnumerable)

Gets the IDataSource instances by the names of the option lists. The result can have a different ordering and size (when option list don't exist) than the input.

Declaration

Task<IList<IDataSource>> GetManyAsync(IEnumerable<string> names)

Parameters

TypeNameDescription
IEnumerable<>stringnamesOption list names (case insensitive).

Returns

TypeDescription
Task<>IList<>IDataSourceNon null collection of IDataSource instances.

GetManyCachedAsync(IEnumerable)

Gets the cached IDataSource instances by the names of the definitions. The result can have a different ordering and size (when option list don't exist) than the input.

Declaration

Task<IList<IDataSource>> GetManyCachedAsync(IEnumerable<string> names)

Parameters

TypeNameDescription
IEnumerable<>stringnamesOption list names (case insensitive).

Returns

TypeDescription
Task<>IList<>IDataSourceNon null collection of IDataSource instances.

UpdateAsync(IDataSource)

Updates a datasource.

Declaration

Task UpdateAsync(IDataSource dataSource)

Parameters

TypeNameDescription
IDataSourcedataSourceThe datasource to update.

Returns

TypeDescription
TaskA representing the asynchronous operation.

Exceptions

TypeCondition
ValidationExceptionThrown when the datasource could not be created because it is not valid. Common cases
datasource contains hierarchical values but has type "Flat".Not all values have an identifier.The identifiers of the values are not unique.
ForbiddenExceptionThrown when the user is not allowed to update datasources.
NotFoundExceptionThrown when the datasource with the specified name could not be found.
If you have suggestions for improving this article, let us know!