Show / Hide Table of Contents

Class Ref<T>

Implementation of an entity reference.

Inheritance
System.Object
RefBase
Ref<T>
LLBLGenRef<T>
Implements
IRef<T>
IRef
IIdentifiable
Inherited Members
RefBase.RefFieldName
RefBase.GetEntityPropertyValue(String)
RefBase.SetEntityPropertyValue(String, Object)
RefBase.GetContainerEntity()
RefBase.GetContainerEntityEntry()
RefBase.GetDataContext(IEntityEntry)
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Kephas.Data
Assembly: Kephas.Data.dll
Syntax
public class Ref<T> : RefBase, IRef<T>, IRef, IIdentifiable where T : class, IIdentifiable
Type Parameters
Name Description
T

The referenced entity type.

Constructors

| Improve this Doc View Source

Ref(Object, String)

Initializes a new instance of the Ref<T> class.

Declaration
public Ref(object containerEntity, string refFieldName)
Parameters
Type Name Description
System.Object containerEntity

The entity containing the reference.

System.String refFieldName

Name of the reference identifier property.

Properties

| Improve this Doc View Source

Entity

Gets or sets the referenced entity.

Declaration
public virtual T Entity { get; set; }
Property Value
Type Description
T

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.

| Improve this Doc View Source

EntityType

Gets the type of the referenced entity.

Declaration
public Type EntityType { get; }
Property Value
Type Description
System.Type

The type of the referenced entity.

| Improve this Doc View Source

Id

Gets or sets the identifier of the referenced entity.

Declaration
public virtual object Id { get; set; }
Property Value
Type Description
System.Object

The identifier of the referenced entity.

| Improve this Doc View Source

IsEmpty

Gets a value indicating whether the reference is empty/not set.

Declaration
public virtual bool IsEmpty { get; }
Property Value
Type Description
System.Boolean

True if this reference is empty, false if not.

Methods

| Improve this Doc View Source

GetAsync(Boolean, CancellationToken)

Gets the referenced entity asynchronously.

Declaration
public virtual Task<T> 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<T>

A task promising the referenced entity.

Explicit Interface Implementations

| Improve this Doc View Source

IIdentifiable.Id

Gets the identifier for this instance.

Declaration
object IIdentifiable.Id { get; }
Returns
Type Description
System.Object

The identifier.

| Improve this Doc View Source

IRef.Entity

Gets or sets the referenced entity.

Declaration
object IRef.Entity { get; set; }
Returns
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.

| Improve this Doc View Source

IRef.GetAsync(Boolean, CancellationToken)

Gets the referenced entity asynchronously.

Declaration
Task<object> IRef.GetAsync(bool throwIfNotFound, CancellationToken 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.

Implements

IRef<T>
IRef
IIdentifiable

Extension Methods

DynamicObjectExtensions.SetPropertyValue(Object, String, Object)
DynamicObjectExtensions.TrySetPropertyValue(Object, String, Object)
DynamicObjectExtensions.GetPropertyValue(Object, String)
DynamicObjectExtensions.TryGetPropertyValue(Object, String, out Object)
DynamicObjectExtensions.GetRuntimeTypeInfo(Object)
DynamicObjectExtensions.ToDynamic(Object)
DynamicObjectExtensions.ToExpando(Object)
BehaviorValue.ToBehaviorValue<TValue>(TValue)
CollectionExtensions.AddRange<T, TItem>(T, IEnumerable<TItem>)
LoggingExtensions.GetLogger(Object, IContext)
TypeExtensions.GetAbstractType(Object)
TypeExtensions.GetAbstractTypeInfo(Object)
ReflectionHelper.GetTypeInfo(Object)
EntityEntryExtensions.TryGetAttachedEntityEntry(Object)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX