Interface IRef
Contract used to define the type of properties referencing entities.
Namespace: Kephas.Data
Assembly: Kephas.Data.dll
Syntax
public interface IRef : IIdentifiable
Properties
| Improve this Doc View SourceEntity
Gets or sets the referenced entity.
Declaration
object Entity { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The referenced entity. |
Remarks
The entity is not ensured to be set prior to calling GetAsync(Boolean, CancellationToken) due to performance reasons, but the actual behavior is left to the implementor.
EntityType
Gets the type of the referenced entity.
Declaration
Type EntityType { get; }
Property Value
Type | Description |
---|---|
System.Type | The type of the referenced entity. |
Id
Gets or sets the identifier of the referenced entity.
Declaration
object Id { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The identifier of the referenced entity. |
IsEmpty
Gets a value indicating whether the reference is empty/not set.
Declaration
bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
System.Boolean | True if this reference is empty, false if not. |
Methods
| Improve this Doc View SourceGetAsync(Boolean, CancellationToken)
Gets the referenced entity asynchronously.
Declaration
Task<object> GetAsync(bool throwIfNotFound = true, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | throwIfNotFound | If true and the referenced entity is not found, an exception occurs. |
System.Threading.CancellationToken | cancellationToken | The cancellation token (optional). |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Object> | A task promising the referenced entity. |