.NET Standard 2.0+
.NET Framework 4.5.2+
.NET Standard 2.0+

Session.SetKeyValue(Object, Object) Method

Assigns the key property's value of the specified persistent object.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v20.2.dll


public void SetKeyValue(
    object theObject,
    object keyValue
Public Sub SetKeyValue(
    theObject As Object,
    keyValue As Object


Name Type Description
theObject Object

A persistent object whose key property value is set.

keyValue Object

An object representing the key property's value.


If the specified persistent object is a null reference, a ArgumentNullException is thrown. If the current session already contains an object with the specified key value, the DifferentObjectsWithSameKeyException is thrown when committing changes to data store.

To get the value of a persistent object's key property, use the Session.GetKeyValue method.

See Also