ISettingsUnitProviderGetOrThrowAsyncT - метод

Retrieves a strongly-typed object derived from the settings unit record identified by the specified key.

Definition

Пространство имён: Tessa.SettingsUnits
Сборка: Tessa (в Tessa.dll) Версия: 4.2.2+a8f0dd3c063817b2e3f05a923303d808e447c338
C#
ValueTask<T> GetOrThrowAsync<T>(
	SettingsUnitKey key,
	Func<SettingsUnitRecord, T> factory,
	CancellationToken cancellationToken = default
)

Параметры

key  SettingsUnitKey
Key for identifying a settings unit or fragment.
factory  FuncSettingsUnitRecord, T
A delegate that receives the SettingsUnitRecord and produces an instance of type T.
Important: The factory delegate should be fast and avoid blocking operations, as it may be called inside a lock.
cancellationToken  CancellationToken  (Optional)
Propagates notification that operations should be canceled.

Параметры типа

T
The type of object to construct from the settings unit record.

Возвращаемое значение

ValueTaskT
The requested object of type T, guaranteed to be non-.

Заметки

When the InitializationState is not Initialized, the record passed to the factory is created with default values rather than loaded from the system. Use the Initialized property to indicate such records. Such record is not cached at provider instance.

Исключения

ValidationException Thrown when the settings unit record could not be loaded or any validation error occurred during the operation.

См. также