.NET Changes - 5.2 to 6.0

  General Resources

API Docs
Forum
Downloads
White Papers
gigaspaces.com     

                                               

Overview

See the full list of features in GigaSpaces 6.0 .NET in the GigaSpaces Release Notes section.

Or, see the .NET documentation.

SqlQuery Wrapper

5.2 Usage

Java SQLQuery generated by CodeMesh was the only way to use SQLQuery functionality with .NET. There were some issues of performance or correctness (especially around PBS) in such scenarios.

6.0 Usage

Use the new SqlQuery wrapper (note the different casing in order to comply with the .NET naming conventions). A generic version (SqlQuery<T>) is available in 6.0, which can be useful if the query is static.

GSIterator Wrapper

5.2 Usage

The Java GSIterator generated by CodeMesh was the only way to use GSIterator functionality with .NET. There were some issues of performance or correctness (especially around PBS) in such scenarios.

6.0 Usage

Use the new GSIterator wrapper. The input/output is automatically converted to/from the PONO within the implementation, including support for the new SqlQuery wrapper.

Proxy creation – API change

5.2 Usage

GigaSpaces.GigaSpace instance

6.0 Usage

GigaSpaces.Core.ISpaceProxy object instance provided by:

GigaSpaces.Core.SpaceProxyProviderFactiory.Instance.FindSpace(string url);
ISpaceProxy proxy = SpaceProxyProviderFactory.Instance.FindSpace(spaceUrl);
Space proxy default properties:
GigaSpaces.Core.ITransaction  ISpaceProxy.DefaultTransaction
 - Null value by default,
Long proxy.DefaultTimeout - 0,
Long proxy.DefaultLeaseTime - long.MaxValue,
Int proxy.DefaultMaxItems - int.MaxValue

Basic PONO Operations – Location and API

5.2 Usage

GigaSpaces.Gigaspace methods: Read(), Write(), Take(), MultipleRead(), MultipleWrite(), and MultipleTake().

Person result = proxy.readMultiple(templatePerson, 
new Transaction(), LeaseImpl.ABSOLUTE);

6.0 Usage

Generic ISpaceProxy methods: Read(), Write(), Take(), MultipleRead(), MultipleWrite(), and MultipleTake() with defaults and overrides.

Person resultRead = proxy.Read<Person>
(templatePerson, txn, readTimeout, ReadModifiers.DirtyRead);

You can use default space proxy values, by using short overrides. For example, Read() with DefaultTransaction, DefaultTimeout and a default ReadModifiers RepeatableRead value:

p = proxy.Read<Person>(template);

In case you don't need feedback, or in case you are using multiple operations on multiple class types, don't use generics, or use generics on object time.

proxy.TakeMultiple(new Person(), 100);

UpdateMultiple Changes

5.2 Usage

UpdateMultiple returned object[] with values or exceptions.

6.0 Usage

UpdateMultiple returns the generic object type array. When exceptions occur, GigaSpaces.Core.Exceptions.UpdateMultipleFailedException is thrown.

Person[] persons_updated =
                   new Person[GS6:persons_for_update.Length];
Try
{
   persons_updated = proxy.UpdateMultiple<Person>(persons);
}
catch (UpdateMultipleFailedException ex)
{ 
 for(int i=0; i<persons_read.Length; i++)
  {
    if (ex.Exceptions[i] != null)
    {
      Console.WriteLine("Update Person " +  
               persons_read[i].Name + " failed.");
     }
     else
       persons_updated[i] = (Person)ex.Ponos.GetValue(i); 
   }                    
}

UpdateMultipleFailedException Added

GigaSpaces.Core.Exceptions.UpdateMultipleFailedException with properties: Exceptions[] on updates and Ponos[] with successfully updated PONOs.

ReadTakeModifiers enum Name and Values Changed

5.2 Usage

GigaSpaces.ReadTakeModifiers with ReadTakeModifiers.DIRTY_READ and ReadTakeModifiers.EXCLUSIVE_READ_LOCK values.

6.0 Usage

GigaSpaces.Core.ReadModifiers with ReadModifiers.DirtyRead, ReadModifiers.ExclusiveReadLock, ReadModifiers.ReadCommitted, and ReadModifiers.RepeatableRead.

Transactions

Local Transaction Creation

5.2 Usage

net.jini.core.transaction.Transaction created by net.jini.core.transaction.TransactionFactory.create().

6.0 Usage

Use ISpaceProxy.CreateLocalTransaction(), or take ISpaceProxy.DefaultTransaction.

ITransaction tx = proxy.CreateLocalTransaction();

LocalTransactionManager Removal

5.2 Usage

com.j_spaces.core.client.LocalTransactionManager

6.0 Usage

No need. ISpaceProxy.CreateLocalTransaction() returns local transactions.

PONO Attributes

Attribute Location

5.2 Usage

GigaSpaces namespace.

6.0 Usage

GigaSpaces.Core.Metadata namespace.

Changes to Attribute Names

5.2 6.0
VersionID SpaceVersion
Key SpaceID
RoutingIndex SpaceRouting
VersionID SpaceVersion

Removal of Fifo, Persist, and Replicate Attributes

5.2 Usage

Fifo, Persist, Replicate.

6.0 Usage

The above are now parameters of the SpaceClass attribute.

New SpaceClass Attribute

The SpaceClass attribute includes optional parameters: Fifo, IncludeFields, IncludeProperties, Persist, Replicate.

IncludeFields and IncludeProperties use IncludeMembers enum with IncludeMembers.Public, IncludeMembers.All and IncludeMembers.None values.

[GS6:SpaceClass(Fifo=true, IncludeProperties = IncludeMembers.Public, IncludeFields = IncludeMembers.None, Persist= false, Replicate=true)]

Removal of Index and Nullable Attributes

5.2 Usage

Index, Nullable.

6.0 Usage

The Index and Nullable attributes are now optional parameters of the SpaceProperty attribute.

Index uses SpaceIndexType enum with SpaceIndexType.Basic and SpaceIndexType.None values.

[GS6:SpaceProperty(Index = SpaceIndexType.Basic, NullValue=-1)]

New GS.XML Function

A PONO object's metadata can be described with an XML file instead of space atttributes.

The file name must include the full .NET class name, followed by .gs.xml. For example:

MyCompany.BO.Person 

File content:

<?xml version="1.0" encoding="UTF-8"?> 
 <!DOCTYPE gigaspaces-mapping PUBLIC "-//GIGASPACES//DTD GS "http://www.gigaspaces.com/dtd/6_0/gigaspaces-metadata.dtd"> 
<gigaspaces-mapping>
   < class name=" MyCompany.BO.Person" persist="false" include-properties="none"    
 replicate="false" fifo="false" mapping-type="space" inherit-indexes ="false" include-fields="false"  >

       <property name="name" index="basic" />
        <exclude name="notes" />
        <id name="person_id"/>
        <property name=" person_id null-value="-1"/>
        <routing name="age" />
        <persist name="person_id"/>
        <version name="version_id"/>
        <reference name="version_id"/>
        
<reference name="age" />


    <class/>
<gigaspaces-mapping/>

EventSession

NotifyDelegator Replaced by EventSession

5.2 Usage

The NotifyDelegator was used.

6.0 Usage

Use EventSession with a listener instead.

EventSession is used to get notifications. You can add listeners with delegate to DefaultDataEventSession, that is created with DefaultEventSessionConfig (Fifo=false, Batch=false, AutoRenew=false).

proxy.DefaultDataEventSession.AddListener<Person>(notifyTemplate, Space_EventHandlerListener, DataEventType.Update, 10000);

For EventHandler listener usage, see SpaceDataEventArgs.

EventSessionConfig exposes the EventSession configuration API.

EventSessionConfig Addition

EventSession is configured with an EventSessionConfig instance.

The DefaultDataEventSession has its own DefaultEventSessionConfig.

SpaceDataEventArgs Event Addition

private static void Space_EventHandlerListener (object sender, SpaceDataEventArgs<Person> e)
		{
              e.EventType;
              e.Pono.Name;
		}

Iterator Changes

5.2 Usage

GigaSpaces.GSIterator.

6.0 Usage

GigaSpaces.Core.ISpaceIterator

object iteratorTemplate = new Person();
using (ISpaceIterator<Person> iterator =   
        proxy.GetSpaceIterator<Person>(iteratorTemplate, 
                    IteratorScope.ExistingAndFutureEntries))
{
  int count = 0;
  foreach (Person item in iterator)	
  {
    Console.WriteLine((count++) + " " + item.Name);
  }
}

IteratorScope enum Addition

Gigaspace.Core.IteratorScope emum with IteratorScope.ExistingAndFutureEntries and IteratorScope.FutureEntries values.

Location of Exceptions

5.2 Usage

Java layer exceptions like JSpaces.client.FinderException.

6.0 Usage

All at GigaSpaces.Core.Exceptions namespace.

Match Class Removal

5.2 Usage

GigaSpaces.Match class with constants.

6.0 Usage

No ExternalEntry extended matching. Use the SqlQuery template instead.

LeaseImpl Removal

5.2 Usage

GigaSpaces.LeaseImpl class with constants.

6.0 Usage

Use the matching numeric definitions: Long.MaxValue instead of LeaseImpl.Forever and the rest of LeaseImpl values.

SpaceSerialization enum Addition

Gigaspace.Core.SpaceSerialization with SpaceSerialization.Direct and SpaceSerialization.Standard values.

DefaultSerializationMode Addition

5.2 Usage

Used to be defined by the App.config.

6.0 Usage

Set\get the proxies: SpaceSerializationMode SpaceProxyProviderFactory.Instance.DefaultSerializationMode, before calling the FindSpace() method.

SpaceProxyProviderFactory.Instance.DefaultSerializationMode = SpaceSerialization.Direct;

Labels

 
(None)