PropertyValues PropertyValues Class

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.

Syntax

Declaration

public abstract class PropertyValuesPublic MustInherit Class PropertyValues

Inheritance Hierarchy

  • System.Object
    System.Object
  • PropertyValues
    PropertyValues

Inherited Members

ToString(),
ToString(),
Equals(Object),
Equals(Object),
Equals(Object, Object),
Equals(Object, Object),
ReferenceEquals(Object, Object),
ReferenceEquals(Object, Object),
GetHashCode(),
GetHashCode(),
GetType(),
GetType(),
MemberwiseClone()
MemberwiseClone()

Constructors summary

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.

Properties summary

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

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.

Gets or sets the value of the property.

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

Gets the properties for which this object is storing values.

Methods summary

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.

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

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

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.

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.

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).

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

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

    Property Value

  • 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

    Property Value

  • 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 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.

    Property 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)

    Property Value

    • System.Collections.Generic.IReadOnlyList<T><IProperty>
      System.Collections.Generic.IReadOnlyList<T>(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

  • GetValue<TValue>(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

    Parameters

    Returns

    • TValue
      TValue

      The value of the property.

  • GetValue<TValue>(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

    Parameters

    • propertyName
      System.String
      System.String

      The property name.

    Returns

    • TValue
      TValue

      The value of the property.

  • 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

  • SetValues(IDictionary<String, Object>)
    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<TKey, TValue><System.String, System.Object>
      System.Collections.Generic.IDictionary<TKey, TValue>(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.

  • 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.

Details

Assembly

Microsoft.EntityFrameworkCore.dll