PartitionKeyAttribute ClassIBM WebSphere™ eXtreme Scale Client for .NET API Specification
IBM WebSphere™ eXtreme Scale Client for .NET Release 8.6.0.0 API Specification

Specifies one or more attributes to use to calculate the partition hash code.

The PartitionKey attribute can be specified for the class using a path syntax to identify a single attribute. Multiple attributes can be specified using additional PartitionKey annotations on each field, using the Order attribute to specify the order in which the hash codes will be calculated.

The PartitionKey attribute is not inheritable.

Inheritance Hierarchy

System Object
  System Attribute
    IBM.WebSphere.Caching.Map PartitionKeyAttribute

Namespace: IBM.WebSphere.Caching.Map
Assembly: Client.Api (in Client.Api.dll) Version: 8.6.0.0
Syntax

Remarks

The following examples illustrate how to identify a top-level, primitive field:

Simple class attribute example:

[PartitionKey("deptId")]
class Employee {
   int empId;
   int deptId;
}

Simple field attribute example:

class Employee {
    int empId;

    [PartitionKey]
    int deptId;
}

Simple, multiple field attribute example:

class Employee {
  int empId;

    [PartitionKey(order=0)]
    int deptId;

    [PartitionKey(order=1)]
    String country;
}

The following examples illustrate how to address an attribute inside an embedded class. In this case, the path separater is defined in the data grid as a "." character (the default for eXtreme Data Format):

Embedded class annotation example:

[PartitionKey("deptKey.id")]
class Employee {
   DepartmentKey deptKey;
}

class DepartmentKey {
   int id;
 }

Embedded field annotation example:

class Employee {
   [PartitionKey("id")]
   DepartmentKey deptKey;
}

class DepartmentKey {
    int id;
}
See Also