PropertyValues PropertyValues Class

Definition

A collection of all property values for an entity.

Objects of this type can be obtained from CurrentValues, OriginalValues, GetDatabaseValues(), or GetDatabaseValuesAsync(CancellationToken). Once obtained, the objects are usually used in various combinations to resolve optimitisic concurrency exceptions signalled by the throwing of a DbUpdateConcurrencyException.

public abstract class PropertyValues
Public MustInherit Class PropertyValues
Inheritance
System.ObjectSystem.Object
PropertyValuesPropertyValues

Constructors

PropertyValues(InternalEntityEntry) PropertyValues(InternalEntityEntry)

This API supports the Entity Framework Core infrastructure and is not intended to be used directly from your code. This API may change or be removed in future releases.

protected PropertyValues(InternalEntityEntry internalEntry)
Protected Sub New(internalEntry As InternalEntityEntry)
Parameters

Properties

EntityType EntityType

Gets the underlying entity type for which this object is storing values.

public virtual IEntityType EntityType { get; }
Public Overridable ReadOnly Property EntityType As IEntityType

InternalEntry InternalEntry

This API supports the Entity Framework Core infrastructure and is not intended to be used directly from your code. This API may change or be removed in future releases.

protected virtual InternalEntityEntry InternalEntry { get; }
Protected Overridable ReadOnly Property InternalEntry As InternalEntityEntry

Item[IProperty] Item(IProperty)

Gets or sets the value of the property.

public abstract object this[IProperty property] { get; set; }
Public MustOverride Property Item(property As IProperty) As Object
Parameters
property
IProperty IProperty

The property.

Value
System.Object System.Object

The value of the property.

Item[String] Item(String)

Gets or sets the value of the property with the specified property name.

public abstract object this[string propertyName] { get; set; }
Public MustOverride Property Item(propertyName As String) As Object
Parameters
propertyName
System.String System.String

The property name.

Value
System.Object System.Object

The value of the property.

Properties Properties

Gets the properties for which this object is storing values.

public abstract IReadOnlyList<IProperty> Properties { get; }
Public MustOverride ReadOnly Property Properties As IReadOnlyList(Of IProperty)
Value
System.Collections.Generic.IReadOnlyList<IProperty> System.Collections.Generic.IReadOnlyList(Of IProperty)

The properties.

Methods

Clone() Clone()

Creates a clone of the values in this object. Changes made to the new object will not be reflected in this object and vice versa.

public abstract PropertyValues Clone()
Public MustOverride Function Clone As PropertyValues
Returns

A clone of this object.

Equals(Object) Equals(Object)

Inherited from System.Object

Equals(Object, Object) Equals(Object, Object)

Inherited from System.Object

GetHashCode() GetHashCode()

Inherited from System.Object

GetType() GetType()

Inherited from System.Object

GetValue(IProperty) GetValue(Of TValue)(IProperty)

Gets the value of the property just like using the indexed property getter but typed to the type of the generic parameter.

public abstract TValue GetValue<TValue>(IProperty property)
Public MustOverride Function GetValue(Of TValue)(property As IProperty) As TValue
Type Parameters
TValue

The type of the property.

Parameters
property
IProperty IProperty

The property.

Returns
TValue TValue

The value of the property.

GetValue(String) GetValue(Of TValue)(String)

Gets the value of the property just like using the indexed property getter but typed to the type of the generic parameter.

public abstract TValue GetValue<TValue>(string propertyName)
Public MustOverride Function GetValue(Of TValue)(propertyName As String) As TValue
Type Parameters
TValue

The type of the property.

Parameters
propertyName
System.String System.String

The property name.

Returns
TValue TValue

The value of the property.

MemberwiseClone() MemberwiseClone()

Inherited from System.Object

ReferenceEquals(Object, Object) ReferenceEquals(Object, Object)

Inherited from System.Object

SetValues(IDictionary) SetValues(IDictionary(Of String, Object))

Sets the values of this object by copying values from the given dictionary.

The keys of the dictionary must match property names. Any key in the dictionary that does not match the name of a property in the entity type will be ignored.

public virtual void SetValues(IDictionary<string, object> values)
Public Overridable Sub SetValues(values As IDictionary(Of String, Object))
Parameters
values
System.Collections.Generic.IDictionary<System.String, System.Object> System.Collections.Generic.IDictionary(Of System.String, System.Object)

The dictionary to read values from.

SetValues(Object) SetValues(Object)

Sets the values of this object by copying values from the given object.

The given object can be of any type. Any property on the object with a name that matches a property name in the entity type and can be read will be copied. Other properties will be ignored. This allows, for example, copying of properties from simple Data Transfer Objects (DTOs).

public abstract void SetValues(object obj)
Public MustOverride Sub SetValues(obj As Object)
Parameters
obj
System.Object System.Object

The object to read values from.

SetValues(PropertyValues) SetValues(PropertyValues)

Sets the values of this object by reading values from another PropertyValues object.

The other object must be based on the same type as this object, or a type derived from the type for this object.

public abstract void SetValues(PropertyValues propertyValues)
Public MustOverride Sub SetValues(propertyValues As PropertyValues)
Parameters
propertyValues
PropertyValues PropertyValues

The object from which values should be coiped.

ToObject() ToObject()

Creates an insatcne of the entity type and sets all its properties using the values from this object.

public abstract object ToObject()
Public MustOverride Function ToObject As Object
Returns
System.Object System.Object

The values of this object copied into a new entity instance.

ToString() ToString()

Inherited from System.Object