Class DependableTrait
Trait for IDependable.
public abstract class DependableTrait : DeputyBase
- Inheritance
-
DependableTrait
Examples
// Usage
var roots = DependableTrait.Get(construct).DependencyRoots;
// Definition
class TraitImplementation : DependableTrait
{
public IConstruct[] DependencyRoots { get; }
public TraitImplementation()
{
DependencyRoots = new [] { constructA, constructB, constructC };
}
}
DependableTrait.Implement(construct, new TraitImplementation());
Remarks
Traits are interfaces that are privately implemented by objects. Instead of showing up in the public interface of a class, they need to be queried explicitly. This is used to implement certain framework features that are not intended to be used by Construct consumers, and so should be hidden from accidental use.
Constructors
DependableTrait()
protected DependableTrait()
Properties
DependencyRoots
The set of constructs that form the root of this dependable.
public abstract IConstruct[] DependencyRoots { get; }
Property Value
Remarks
All resources under all returned constructs are included in the ordering dependency.
Methods
Get(IDependable)
Return the matching DependableTrait for the given class instance.
public static DependableTrait Get(IDependable instance)
Parameters
instance
IDependable
Returns
Implement(IDependable, DependableTrait)
Register instance
to have the given DependableTrait.
public static void Implement(IDependable instance, DependableTrait trait)
Parameters
instance
IDependabletrait
DependableTrait
Remarks
Should be called in the class constructor.