Table of Contents

Class AttributeBase<TStorage, TPresentation>

Namespace
The.Attributes
Assembly
Instagile.dll

Attribute which represents a datastore column, either set manually or calculated by supplied code.

[DataContract]
public abstract class AttributeBase<TStorage, TPresentation> : AttributeBase, IProperty, IOwned, IHasChanges, IComparable, IComparable<AttributeBase<TStorage, TPresentation>>

Type Parameters

TStorage
TPresentation
Inheritance
AttributeBase<TStorage, TPresentation>
Implements
IComparable<AttributeBase<TStorage, TPresentation>>
Derived
Inherited Members

Remarks

basically this class has a mode matrix, four modes for each combo of IsCalculated and IsTransient - it is at the root of an inheritance hierarchy :( a cool refactoring would be to split out the part which depends on properties into a composed part with multiple implementations. however, i made an attempt at this and it seemed to increase rather than reduce complexity

Properties

DynamicTypeDefault

public override sealed object? DynamicTypeDefault { get; }

Property Value

object

DynamicValue

public override object? DynamicValue { get; set; }

Property Value

object

IsDefaulted

public bool IsDefaulted { get; set; }

Property Value

bool

OriginalValue

public TStorage OriginalValue { get; }

Property Value

TStorage

PersistenceValue

protected virtual TStorage PersistenceValue { get; set; }

Property Value

TStorage

Value

[DataMember]
public abstract TPresentation Value { get; set; }

Property Value

TPresentation

ValueType

public override Type ValueType { get; }

Property Value

Type

Methods

CalculateAsync()

public override Task CalculateAsync()

Returns

Task

Compare(TStorage, TStorage)

protected abstract int Compare(TStorage left, TStorage right)

Parameters

left TStorage
right TStorage

Returns

int

CompareNullable<U>(U?, U?, Func<U, U, int>)

public static int CompareNullable<U>(U? left, U? right, Func<U, U, int> compare) where U : struct

Parameters

left U?
right U?
compare Func<U, U, int>

Returns

int

Type Parameters

U

CompareTo(object?)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

public override int CompareTo(object? other)

Parameters

other object

Returns

int

A value that indicates the relative order of the objects being compared. The return value has these meanings:

Value Meaning
Less than zero This instance precedes obj in the sort order.
Zero This instance occurs in the same position in the sort order as obj.
Greater than zero This instance follows obj in the sort order.

Exceptions

ArgumentException

obj is not the same type as this instance.

CompareTo(AttributeBase<TStorage, TPresentation>?)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

public int CompareTo(AttributeBase<TStorage, TPresentation>? other)

Parameters

other AttributeBase<TStorage, TPresentation>

An object to compare with this instance.

Returns

int

A value that indicates the relative order of the objects being compared. The return value has these meanings:

Value Meaning
Less than zero This instance precedes other in the sort order.
Zero This instance occurs in the same position in the sort order as other.
Greater than zero This instance follows other in the sort order.

HasChanges()

true if the current value differs from its original

public override bool HasChanges()

Returns

bool

InternalCopy(AttributeBase, AttributeBase)

protected override void InternalCopy(AttributeBase from, AttributeBase to)

Parameters

from AttributeBase
to AttributeBase

MarkUnchanged()

update original data so that it's no longer considered changed

public override void MarkUnchanged()

Normalise(TStorage?, bool)

protected virtual TStorage Normalise(TStorage? newValue, bool isCalculated)

Parameters

newValue TStorage
isCalculated bool

Returns

TStorage

RaiseOrDeferValueChanged()

protected void RaiseOrDeferValueChanged()

TypeDefault()

public abstract TStorage TypeDefault()

Returns

TStorage