Class TimeSpanWrapper
Utility for containing a string converted to timespan in config objects. To use: public string MyIntervalValue { get; } = new TimeSpanWrapper(false, "s", "0"); public string MyInterval { get => MyIntervalValue.RawValue; set => MyIntervalValue.RawValue = value; }
Access MyIntervalValue.Value in your code, and MyInterval is the config option.
Implements
Inherited Members
Namespace: Cognite.Extractor.Common
Assembly: Cognite.Common.dll
Syntax
public class TimeSpanWrapper : ITimeSpanProvider
Constructors
| Edit this page View SourceTimeSpanWrapper(bool, string, string)
Create a new timespan wrapper. The wrapper is intended to be a singleton, i.e. it is not recreated if the config is modified.
Declaration
public TimeSpanWrapper(bool allowZero, string defaultUnit, string defaultValue)
Parameters
Type | Name | Description |
---|---|---|
bool | allowZero | |
string | defaultUnit | |
string | defaultValue |
Properties
| Edit this page View SourceIntRawValue
Internal raw value.
Declaration
protected string IntRawValue { get; set; }
Property Value
Type | Description |
---|---|
string |
IsDynamic
Whether the interval is dynamic or not, e.g. cron expression
Declaration
public virtual bool IsDynamic { get; }
Property Value
Type | Description |
---|---|
bool |
RawValue
Raw string value of option.
Declaration
public virtual string RawValue { get; set; }
Property Value
Type | Description |
---|---|
string |
Value
Converted value as TimeSpan.
Declaration
public virtual TimeSpan Value { get; }
Property Value
Type | Description |
---|---|
TimeSpan |