EntityObjectIsGhost 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 override bool IsGhost { get; }
Public Overrides ReadOnly Property IsGhost As Boolean
Get
public:
virtual property bool IsGhost {
bool get () override;
}
abstract IsGhost : bool with get
override IsGhost : bool with get
Property Value
Type:
Boolean
Remarks
Ghost objects allow easy traversing of relationship chains without null checking.
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, which are 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