Class DataSource
- Namespace
- Temporalio.Common.EnvConfig
- Assembly
- Temporalio.dll
A data source for configuration, which can be a path to a file, the string contents of a file, or raw bytes.
public sealed class DataSource
- Inheritance
-
DataSource
- Inherited Members
Properties
Data
Gets the raw data for this data source, if applicable.
public byte[]? Data { get; }
Property Value
- byte[]
Path
Gets the file path for this data source, if applicable.
public string? Path { get; }
Property Value
Methods
FromBytes(byte[])
Create a data source from raw bytes.
public static DataSource FromBytes(byte[] data)
Parameters
databyte[]Configuration data as raw bytes.
Returns
- DataSource
A new data source for the specified data.
Exceptions
- ArgumentException
Thrown when data is null or empty.
FromDictionary(IReadOnlyDictionary<string, string>?)
Create a data source from a dictionary containing either "data" or "path" keys.
public static DataSource? FromDictionary(IReadOnlyDictionary<string, string>? dictionary)
Parameters
dictionaryIReadOnlyDictionary<string, string>Dictionary containing configuration data or path.
Returns
- DataSource
A new data source, or null if the dictionary is null or contains neither "data" nor "path".
FromPath(string)
Create a data source from a file path.
public static DataSource FromPath(string path)
Parameters
pathstringPath to the configuration file.
Returns
- DataSource
A new data source for the specified file.
Exceptions
- ArgumentException
Thrown when path is null or empty.
FromUTF8String(string)
Create a data source from string content.
public static DataSource FromUTF8String(string content)
Parameters
contentstringConfiguration data as a UTF-8 string.
Returns
- DataSource
A new data source for the specified data.
Exceptions
- ArgumentException
Thrown when content is null.
ToDictionary()
Convert a data source to a dictionary for TOML serialization.
public Dictionary<string, string>? ToDictionary()
Returns
- Dictionary<string, string>
A dictionary with either "path" or "data" key, or null if neither key exists.