Table of Contents

Class EntityViewExtensions

Namespace
GroupeIsa.Neos.Application
Assembly
GroupeIsa.Neos.Application.Abstractions.dll

Represents IEntityView<TEntityView> extensions.

public static class EntityViewExtensions
Inheritance
EntityViewExtensions
Inherited Members

Methods

AcceptChanges(IUnboundEntityView)

Accepts changes.

public static void AcceptChanges(this IUnboundEntityView entityView)

Parameters

entityView IUnboundEntityView

Entity view.

CopyFrom<TEntity>(IBoundEntityView<TEntity>, TEntity)

Copies the properties from a source entity.

public static void CopyFrom<TEntity>(this IBoundEntityView<TEntity> entityView, TEntity entity) where TEntity : BusinessEntity

Parameters

entityView IBoundEntityView<TEntity>

The entity view.

entity TEntity

The entity.

Type Parameters

TEntity

The entity type.

GetEntity<TEntity>(IBoundEntityView<TEntity>)

Gets the entity from an entity view.

public static TEntity GetEntity<TEntity>(this IBoundEntityView<TEntity> entityView) where TEntity : BusinessEntity

Parameters

entityView IBoundEntityView<TEntity>

The entity view.

Returns

TEntity

The entity.

Type Parameters

TEntity

The entity type.

GetOriginalOrCurrentValue<T>(IEntityView, string)

Gets the original value if the property has been modified, otherwise returns the current value.

public static T GetOriginalOrCurrentValue<T>(this IEntityView entityView, string propertyName)

Parameters

entityView IEntityView

Entity view.

propertyName string

The name of the property.

Returns

T

The original value if modified, otherwise the current value.

Type Parameters

T

The type of the property value.

Examples

int quantity = entityView.GetOriginalOrCurrentValue<int>(nameof(entityView.Quantity));

GetOriginalValue<T>(IEntityView, string)

Get the original value of property name.

public static T GetOriginalValue<T>(this IEntityView entityView, string propertyName)

Parameters

entityView IEntityView

Entity view.

propertyName string

The property name.

Returns

T

The original value if the property has been changed; throws KeyNotFoundException otherwise.

Type Parameters

T

Value type.

Remarks

If you need to verify beforehand whether an original value exists for the specified property, consider using the HasOriginalValue(IEntityView, string) method.

GetState(IEntityView)

Gets the entity view state.

public static EntityViewState GetState(this IEntityView entityView)

Parameters

entityView IEntityView

Entity view.

Returns

EntityViewState

The entity view state.

HasModifiedNavigationProperty(IEntityView)

Indicates whether the entity view has modified navigation property.

public static bool HasModifiedNavigationProperty(this IEntityView entityView)

Parameters

entityView IEntityView

Entity view.

Returns

bool

True if a navigation property has modified; otherwise, false.

HasOriginalValue(IEntityView, string)

Gets the value indicating whether the item has an original value.

public static bool HasOriginalValue(this IEntityView entityView, string propertyName)

Parameters

entityView IEntityView

Entity view.

propertyName string

The property name.

Returns

bool

True if the original value has a value.

Remarks

To retrieve the original value of the specified property, use the GetOriginalValue<T>(IEntityView, string) method.

IsTracked(IEntityView)

Gets a value indicating whether the entity view instance is tracked.

public static bool IsTracked(this IEntityView entityView)

Parameters

entityView IEntityView

Entity view.

Returns

bool

True if the instance is tracked (two-way binding with a source entity), false otherwise.

TryGetEntity<TEntity>(IBoundEntityView<TEntity>?, out TEntity)

Tries to get the entity from an entity view.

public static bool TryGetEntity<TEntity>(this IBoundEntityView<TEntity>? entityView, out TEntity entity) where TEntity : BusinessEntity

Parameters

entityView IBoundEntityView<TEntity>

The entity view.

entity TEntity

The entity.

Returns

bool

The entity or null.

Type Parameters

TEntity

The entity type.