Back to Devexpress

XPMemberInfo.SetValue(Object, Object) Method

xpo-devexpress-dot-xpo-dot-metadata-dot-xpmemberinfo-dot-setvalue-x28-system-dot-object-system-dot-object-x29.md

latest5.3 KB
Original Source

XPMemberInfo.SetValue(Object, Object) Method

When implemented in a derived class, sets the property’s value.

Namespace : DevExpress.Xpo.Metadata

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
public abstract void SetValue(
    object theObject,
    object theValue
)
vb
Public MustOverride Sub SetValue(
    theObject As Object,
    theValue As Object
)

Parameters

NameTypeDescription
theObjectObject

An object whose property value will be set.

| | theValue | Object |

An object which represents the new value for this property.

|

The following code snippets (auto-collected from DevExpress Examples) contain references to the SetValue(Object, Object) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

asp-net-mvc-grid-custom-binding-and-xpo/CS/XPCustomBindingExample/XPO/StartupHelper.cs#L40

csharp
object order = classInfo.CreateNewObject(uow);
classInfo.GetMember("ID").SetValue(order, i + 1);
classInfo.GetMember("ProductName").SetValue(order, getRandomName());

xaf-how-to-use-the-file-attachment-module-with-a-legacy-database/CS/CustomFileDataSolution.Module/BusinessObjects/InplaceFileData.cs#L26

csharp
public void Clear() {
    member.SetValue(host, null);
}

XPO_how-to-create-persistent-classes-mapped-to-tables-with-a-composite-primary-key-at-runtime-e4606/CS/XpoConsoleApplication/XPComplexCustomMemberInfo.cs#L67

csharp
if (memberInfo.IsPersistent) {
    memberInfo.SetValue(theObject, list[i]);
}

XPO_how-to-implement-odata4-service-with-xpo-netcore/CS/ODataService/Helpers/ApiHelper.cs#L46

csharp
var reference = uow.GetObjectByKey(memberInfo.ReferenceType, relatedKey);
    memberInfo.SetValue(entity, reference);
} else {

XPO_how-to-implement-odata4-service-with-xpo/CS/ODataService/Helpers/ApiHelper.cs#L55

csharp
var reference = uow.GetObjectByKey(memberInfo.ReferenceType, relatedKey);
    memberInfo.SetValue(entity, reference);
} else {

asp-net-mvc-grid-custom-binding-and-xpo/VB/XPCustomBindingExample/XPO/StartupHelper.vb#L47

vb
Dim order As Object = classInfo.CreateNewObject(uow)
classInfo.GetMember("ID").SetValue(order, i + 1)
classInfo.GetMember("ProductName").SetValue(order, getRandomName())

xaf-how-to-use-the-file-attachment-module-with-a-legacy-database/VB/CustomFileDataSolution.Module/BusinessObjects/InplaceFileData.vb#L28

vb
Public Sub Clear() Implements IFileData.Clear
    member.SetValue(host, Nothing)
End Sub

XPO_how-to-clone-a-persistent-object-e804/VB/SimpleObject/CloneHelper.vb#L63

vb
End If
    memberInfo.SetValue(target, clonedValue)
End Sub

See Also

GetValue(Object)

XPMemberInfo Class

XPMemberInfo Members

DevExpress.Xpo.Metadata Namespace