|
Overview
SqlQuery Wrapper5.2 UsageJava 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 UsageUse 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 Wrapper5.2 UsageThe 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 UsageUse 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 change5.2 UsageGigaSpaces.GigaSpace instance 6.0 UsageGigaSpaces.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 API5.2 UsageGigaSpaces.Gigaspace methods: Read(), Write(), Take(), MultipleRead(), MultipleWrite(), and MultipleTake(). Person result = proxy.readMultiple(templatePerson,
new Transaction(), LeaseImpl.ABSOLUTE);
6.0 UsageGeneric 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 Changes5.2 UsageUpdateMultiple returned object[] with values or exceptions. 6.0 UsageUpdateMultiple 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 AddedGigaSpaces.Core.Exceptions.UpdateMultipleFailedException with properties: Exceptions[] on updates and Ponos[] with successfully updated PONOs. ReadTakeModifiers enum Name and Values Changed5.2 UsageGigaSpaces.ReadTakeModifiers with ReadTakeModifiers.DIRTY_READ and ReadTakeModifiers.EXCLUSIVE_READ_LOCK values. 6.0 UsageGigaSpaces.Core.ReadModifiers with ReadModifiers.DirtyRead, ReadModifiers.ExclusiveReadLock, ReadModifiers.ReadCommitted, and ReadModifiers.RepeatableRead. TransactionsLocal Transaction Creation5.2 Usagenet.jini.core.transaction.Transaction created by net.jini.core.transaction.TransactionFactory.create(). 6.0 UsageUse ISpaceProxy.CreateLocalTransaction(), or take ISpaceProxy.DefaultTransaction. ITransaction tx = proxy.CreateLocalTransaction(); LocalTransactionManager Removal5.2 Usagecom.j_spaces.core.client.LocalTransactionManager 6.0 UsageNo need. ISpaceProxy.CreateLocalTransaction() returns local transactions. PONO AttributesAttribute Location | Changes to Attribute Names | Removal of Fifo, Persist, and Replicate Attributes | New SpaceClass Attribute | Removal of Index and Nullable Attributes
Attribute Location5.2 UsageGigaSpaces namespace. 6.0 UsageGigaSpaces.Core.Metadata namespace. Changes to Attribute Names
Removal of Fifo, Persist, and Replicate Attributes5.2 UsageFifo, Persist, Replicate. 6.0 UsageThe above are now parameters of the SpaceClass attribute. New SpaceClass AttributeThe 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 Attributes5.2 UsageIndex, Nullable. 6.0 UsageThe 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 FunctionA 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/> EventSessionNotifyDelegator Replaced by EventSession | EventSessionConfig Addition | SpaceDataEventArgs Event Addition
NotifyDelegator Replaced by EventSession5.2 UsageThe NotifyDelegator was used. 6.0 UsageUse 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 AdditionEventSession is configured with an EventSessionConfig instance. The DefaultDataEventSession has its own DefaultEventSessionConfig. SpaceDataEventArgs Event Additionprivate static void Space_EventHandlerListener (object sender, SpaceDataEventArgs<Person> e) { e.EventType; e.Pono.Name; } Iterator Changes5.2 UsageGigaSpaces.GSIterator. 6.0 UsageGigaSpaces.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 AdditionGigaspace.Core.IteratorScope emum with IteratorScope.ExistingAndFutureEntries and IteratorScope.FutureEntries values. Location of Exceptions5.2 UsageJava layer exceptions like JSpaces.client.FinderException. 6.0 UsageAll at GigaSpaces.Core.Exceptions namespace. Match Class Removal5.2 UsageGigaSpaces.Match class with constants. 6.0 UsageNo ExternalEntry extended matching. Use the SqlQuery template instead. LeaseImpl Removal5.2 UsageGigaSpaces.LeaseImpl class with constants. 6.0 UsageUse the matching numeric definitions: Long.MaxValue instead of LeaseImpl.Forever and the rest of LeaseImpl values. SpaceSerialization enum AdditionGigaspace.Core.SpaceSerialization with SpaceSerialization.Direct and SpaceSerialization.Standard values. DefaultSerializationMode Addition5.2 UsageUsed to be defined by the App.config. 6.0 UsageSet\get the proxies: SpaceSerializationMode SpaceProxyProviderFactory.Instance.DefaultSerializationMode, before calling the FindSpace() method. SpaceProxyProviderFactory.Instance.DefaultSerializationMode = SpaceSerialization.Direct; |
.NET Changes - 5.2 to 6.0
(None)
See the full list of features in GigaSpaces 6.0 .NET in the