Class Dependency
- Namespace
- Cuemon.Runtime
- Assembly
- Cuemon.Core.dll
Represents the base class from which all implementations of dependency relationship to an object should derive.
public abstract class Dependency : IDependency
- Inheritance
-
Dependency
- Implements
- Derived
Remarks
The implementing class of the Dependency class must monitor the dependency relationships so that when any of them changes, action will automatically be taken.
Constructors
Dependency(Func<EventHandler<WatcherEventArgs>, IEnumerable<IWatcher>>, Boolean)
Initializes a new instance of the Dependency class.
protected Dependency(Func<EventHandler<WatcherEventArgs>, IEnumerable<IWatcher>> watchersHandler, bool breakTieOnChanged)
Parameters
watchersHandler
Func<EventHandler<WatcherEventArgs>, IEnumerable<IWatcher>>The function delegate that associates watchers to this dependency.
breakTieOnChanged
Booleanif set to
true
all IWatcher instances is disassociated with this dependency after first notification of changed.
Properties
BreakTieOnChanged
Gets a value indicating whether all IWatcher instances is disassociated with this dependency after first notification of changed.
public bool BreakTieOnChanged { get; }
Property Value
- Boolean
true
if all IWatcher instances is disassociated with this dependency after first notification of changed; otherwise,false
.
HasChanged
Gets a value indicating whether the Dependency object has changed.
public virtual bool HasChanged { get; }
Property Value
- Boolean
true
if the Dependency object has changed; otherwise,false
.
UtcLastModified
Gets time when the dependency was last changed.
public DateTime? UtcLastModified { get; }
Property Value
Remarks
This property is measured in Coordinated Universal Time (UTC) (also known as Greenwich Mean Time).
Methods
OnDependencyChangedRaised(DependencyEventArgs)
Raises the DependencyChanged event.
protected virtual void OnDependencyChangedRaised(DependencyEventArgs e)
Parameters
e
DependencyEventArgsThe DependencyEventArgs instance containing the event data.
OnWatcherChanged(Object, WatcherEventArgs)
Called when this object receives a signal from one or more of the associated IWatcher.
protected virtual void OnWatcherChanged(object sender, WatcherEventArgs args)
Parameters
sender
ObjectThe source of the event.
args
WatcherEventArgsThe WatcherEventArgs instance containing the event data.
SetUtcLastModified(DateTime)
Marks the time when a dependency last changed.
protected void SetUtcLastModified(DateTime utcLastModified)
Parameters
utcLastModified
DateTimeThe time when the dependency last changed.
Start()
Starts and performs the necessary dependency tasks of this instance.
public virtual void Start()
StartAsync()
Starts and performs the necessary dependency tasks of this instance.
public virtual Task StartAsync()
Returns
- Task
The task object representing the asynchronous operation.
Events
DependencyChanged
Occurs when a Dependency has changed.
public event EventHandler<DependencyEventArgs> DependencyChanged