expressappframework-devexpress-dot-expressapp-dot-iobjectspace-dot-getobjectkey-x28-system-dot-type-system-dot-string-x29.md
Converts the key property value string representation into its actual type.
Namespace : DevExpress.ExpressApp
Assembly : DevExpress.ExpressApp.v25.2.dll
NuGet Package : DevExpress.ExpressApp
object GetObjectKey(
Type objectType,
string objectKeyString
)
Function GetObjectKey(
objectType As Type,
objectKeyString As String
) As Object
| Name | Type | Description |
|---|---|---|
| objectType | Type |
A Type object which is the type of the object whose key property value is to be converted.
| | objectKeyString | String |
A string that is the key property value to be converted.
|
| Type | Description |
|---|---|
| Object |
An object that is the value of the specified type object’s key property.
|
When implementing the IObjectSpace interface in the BaseObjectSpace class’s descendant, don’t implement the GetObjectKey method. It’s implemented in the BaseObjectSpace class. The BaseObjectSpace.GetObjectKey method returns null, but it is virtual. So, you should override it in your descendant.
The following code snippets (auto-collected from DevExpress Examples) contain references to the GetObjectKey(Type, String) 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.
using(var objectSpace = _securedObjectSpaceFactory.CreateObjectSpace(type)) {
var key = objectSpace.GetObjectKey(type, objectKey);
return Ok(_security.CanWrite(type, objectSpace, key));
using var nonSecuredObjectSpace = nonSecuredObjectSpaceFactory.CreateNonSecuredObjectSpace(securityUserType);
var userKey = nonSecuredObjectSpace.GetObjectKey(securityUserType, token.UserId);
var user = (ISecurityUserWithLoginInfo)nonSecuredObjectSpace.GetObjectByKey(securityUserType, userKey);
See Also