|
OverviewIn this section, we build and run .NET applications using the GigaSpaces PONO API:
Checking PrequisitesMake sure you have the following installed:
Installing GigaSpaces
Before installing GigaSpaces, make sure:
After unzipping the zip file, you should have the following files and folders under the <GigaSpaces Root> folder:
Testing Environment
Creating New .NET Project
Project ReferencesAdd the GigaSpaces.Core.dll file located under GigaSpaces Root\dotnet\lib into your project references:
Creating Data ClassCreate a new data class as seen below:
using System; using GigaSpaces.Core.Metadata; namespace myHelloSpace { class MyData { [SpaceProperty(Index = SpaceIndexType.Basic)] public string firstName; public string lastName; [SpaceProperty(NullValue = "1/1/1900 12:00:00")] public DateTime dob; } } Write and Read Objects - the Applicationusing System; using System.Collections.Generic; using System.Text; using GigaSpaces.Core; namespace myHelloSpace { class Program { static void Main(string[] args) { // Getting space proxy ISpaceProxy space = SpaceProxyProviderFactory.Instance.FindSpace("rmi://localhost/./mySpace"); if (space != null) Console.WriteLine("Connect to space OK!"); MyData data = new MyData(); data.firstName = "Joe"; data.lastName = "lastname"; data.dob = new DateTime(1980, 1, 20, 10, 20, 0, DateTimeKind.Utc); // we write the data object into the space for a day space.Write<MyData>(data, null, 1000 * 60 * 24); Console.WriteLine("Wrote data to space OK!"); // read using simple template MyData template = new MyData(); template.firstName = "Joe"; template.dob = new DateTime(1900, 1, 1, 12, 0, 0, DateTimeKind.Utc); // null value MyData dataFromSpace = space.Read<MyData>(template, null, 1000); if (dataFromSpace != null) Console.WriteLine("Read data from space OK!"); Console.WriteLine("FirstName:" + dataFromSpace.firstName + " LastName:" + dataFromSpace.lastName + " Dob:" + dataFromSpace.dob); } } Add GigaSpaces Managment Center ToolTo activate the GigaSpaces Browser (allows you to view spaces, space classes, Entries, etc.), add a new tool directly from the Studio IDE:
Start Space
Build and Run the Application
For example: JAVA_HOME=D:\JDK\jdk1.5.0_04 JSHOMEDIR=C:\GigaSpacesXAP6.0
View Data Inside Space
View Space EntriesSelect the myData class line, and click the Query button. The Query view is displayed. This shows your .NET PONO inside the space:
64-bit Compilation
csc.exe /target:exe /platform:anycpu /out:Release/benchmark.exe /recurse:./*.cs /reference:..\..\lib\GigaSpaces.Core.dll
|
(works on Firefox 2 and Internet Explorer 7)

For more details, refer to the 









