Class Annotations

The GigaSpaces API supports class level decorations with PONOs. These can be specified via annotations on the space class source itself for all class instances.

Alias Name

Syntax AliasName
Argument String
Description By default, the name of the class in the SpaceClosed Where GigaSpaces data is stored. It is the logical cache that holds data objects in memory and might also hold them in layered in tiering. Data is hosted from multiple SoRs, consolidated as a unified data model. is the fully-qualified class name (i.e. including namespace). In some cases, usually in interoperability scenarios, you may need to map your C# Class name and properties to different names in the Space.

Example:

[SpaceClass(AliasName="com.mycompany.myproject.Person")]
public class Person {
//
}

For more information, see the Platform Interoperability section.

Persistence

Syntax Persist
Argument boolean
Default false
Description When a Space is defined as persistent, a "true' value for this annotation persists objects of this type.

Example:

[SpaceClass(Persist=true)]
public class Person {
//
}

For more information, see the Space Persistency section.

Include Properties

Syntax IncludeFields, IncludeProperties
Argument IncludeMembers
Default IncludeFields=IncludeMembers.All, IncludeProperties=IncludeMembers.All)
Description By default, all public members (fields and properties) in a class are stored in the space, whereas non-public members are ignored. Since classes are usually designed with private/protected fields and public properties wrapping them, in most cases the default behavior is also the desired one.

Example:

[SpaceClass(IncludeFields=IncludeMembers.Public, IncludeProperties=IncludeMembers.Public)]
public class Person {
  //
}

Starting with .NET v2.0, properties can have different accessors for getters and setters (e.g. public getter and private setter). In such cases, if either the getter or the setter is public, the space treats the property as public (i.e. IncludeProperties=IncludeMembers.Public means that this property is stored).

Read-only properties (getter without setter) are stored in the space, but when the object is de-serialized, the value is not restored, since there is no setter. This enables the space to be queried using such properties. There are two common scenarios for read-only properties:

  • Calculated value - the property returns a calculated value based on other properties. This isn't a problem since no data is lost due to the "missing' setter.
  • Access protection - the class designer wishes to protect the property from outside changes. This is probably a problem since the field value is lost. To prevent this problem, consider adding a private setter, or excluding the property and including the field (as explained next).

FIFO Support

Syntax FifoSupport
Argument FifoSupport
Default FifoSupport.Off
Description To enable FIFOClosed FIFO is an acronym for first in, first out, a method for organizing the manipulation of a data structure where the oldest entry, or "head" of the queue, is processed first. operations, set this attribute to FifoSupport.Operation

Example:

[SpaceClass(FifoSupport=FifoSupport.Operation)]
public class Person {
  //
}

For more information, see the FIFO Support page.

Inherit Index

Syntax InheritIndexes
Argument boolean
Default true
Description Whether to use the class indexes list only, or to also include the superclass' indexes.
If the class does not define indexes, superclass indexes are used.
Options:
- false – class indexes only.
- true – class indexes and superclass indexes.

Example:

[SpaceClass(InheritIndexes=false)]
public class Person {
  //
}

For more information, see the Indexing section.

Replication

Syntax Replicate
Argument boolean
Default true
Description When running in a partial replication mode, a false value for this property will not replicates all objects from this class type to the replica space or backup space.}

Example:

[SpaceClass(Replicate=false)]
public class Person {
  //
}

For more information, see the Replication section in the Administration guide.

Compound Index

Syntax CompoundSpaceIndex Paths
Argument(s) string
Values attribute name(s)
Description Indexes can be defined for multiple properties of a class

Example:

[CompoundSpaceIndex(Paths = new[] {"FirstName", "LastName"})]
[SpaceClass]
public class User {
     ....
     public String FirstName;
     public String LastName;

}

For more information, see the Compound Index page.