DomainObjectIsGhost Property |
Returns true when the object is a ghost object
Namespace:
Aloe.SystemFrameworks.Domain
Assembly:
Aloe.SystemFrameworks.Domain (in Aloe.SystemFrameworks.Domain.dll) Version: 20.1.3.5
Syntaxpublic abstract bool IsGhost { get; }
Public MustOverride ReadOnly Property IsGhost As Boolean
Get
public:
virtual property bool IsGhost {
bool get () abstract;
}
abstract IsGhost : bool with get
Property Value
Type:
Boolean
Remarks
Ghost objects allow easy traversing of relationship chains without null checking.
Ghost object are primarily used by following a reference to
EntityObject,
but is possible other descendants of
DomainObject to also allow and use ghost objects concept.
The basic idea and usage of ghost objects are illustrated in the following example:
SalesOrderLine l = ...;
l.Product = null;
if(l.Product == null)
Console.WriteLine("null");
else
Console.WriteLine(l.Product.Name);
Console.WriteLine(l.Product.Name);
Ghost objects are special instances, usually created by following a null reference.
Ghosts are of the same type as the other objects of the same repository.
All data attributes of ghost objects return null when get and throw InvalidOperationException if an attempt
is made to set a value.
The references of ghost objects return other ghost objects when get and throw InvalidOpeartionException on set.
See Also