Search Results for

Show / Hide Table of Contents

# Class AffinityKeyMappedAttribute

Specifies cache key field to be used to determine a node on which given cache key will be stored. Only one field or property can be marked with this attribute.

This attribute is an alternative to AffinityKeyFieldName setting. This attribute has lower priority than AffinityKeyFieldName setting.

One of the major use cases for this attribute is the routing of grid computations to the nodes where the data for this computation is cached, the concept otherwise known as Colocation Of Computations And Data.

For example, if a Person object is always accessed together with a Company object for which this person is an employee, then for better performance and scalability it makes sense to colocate Person objects together with their Company object when storing them in cache. To achieve that, cache key used to cache Person objects should have a field or property marked with AffinityKeyMappedAttribute attribute, which will provide the value of the company key for which that person works.

##### Inheritance

System.Object
AffinityKeyMappedAttribute

###### Namespace: Apache.Ignite.Core.Cache.Affinity

###### Assembly: Apache.Ignite.Core.dll

##### Syntax

    public sealed class AffinityKeyMappedAttribute : Attribute

### Methods

#### GetFieldNameFromAttribute(Type)

Gets the affinity key field name from attribute.

##### Declaration

    public static string GetFieldNameFromAttribute(Type type)

##### Parameters

Type | Name | Description
--- | --- | ---
Type | type |

##### Returns

Type | Description
--- | ---
System.String |