Share via


PropertyValues Class

Definition

A collection of all property values for an entity.

public abstract class PropertyValues
type PropertyValues = class
Public MustInherit Class PropertyValues
Inheritance
PropertyValues

Remarks

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 optimistic concurrency exceptions signaled by the throwing of a DbUpdateConcurrencyException.

See Accessing tracked entities in EF Core for more information and examples.

Constructors

PropertyValues(InternalEntityEntry)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

Properties

EntityType

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

InternalEntry

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

Item[IProperty]

Gets or sets the value of the property.

Item[String]

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

Properties

Gets the properties for which this object is storing values.

Methods

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.

GetValue<TValue>(IProperty)

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

GetValue<TValue>(String)

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

SetValues(IDictionary<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.

SetValues(Object)

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

SetValues(PropertyValues)

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

SetValues<TProperty>(IDictionary<String,TProperty>)

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

ToObject()

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

TryGetValue<TValue>(String, TValue)

Try to gets the value of the property just like using the indexed property getter but typed to the type of the generic parameter. If property exists it return the value into the out parameter, otherwise the default value of TValue

Applies to