.NET Client API
This section describes the primary classes, usage conventions, and C++ to .NET class mappings of the .NET client API. It demonstrates how to use the API to create caches and perform data serialization.
The Microsoft .NET Framework interface for the client provides complete access to the C++ client functionality from any .NET Framework language (C#, C++/CLI, VB.NET, and J#). This enables clients using C# and other .NET languages to use the capabilities provided by the C++ API.
Wherever the native C++ class methods use pass-by-reference semantics to return data, the corresponding .NET methods return the object instead of using pass-by-reference semantics.
The following table provides a mapping between Java and .NET types.
The .NET API provides a managed set of assemblies for the C++ API. The underlying C++ object will stay in memory until the .NET object is garbage-collected.
Application domains, or
AppDomains, are units of isolation, security boundaries, and loading and unloading for applications in the .NET runtime. Multiple application domains can run in a single process. Each can have one or many threads, and a thread can switch application domains at runtime.
You create a cache using the GemFire
CacheFactory.Createcall. Cache creation initializes the distributed system and creates the cache using your
cache.xmlfile settings and any additional properties you provide to the call.
To create a region, you create a
RegionShortcutthat most closely fits your region configuration.
You populate a native client region with cache entries by using the generic
IDictionaryAPI or by using the .NET
The region entry retrieval methods return the value associated with the specified key, and pass the callback argument to any cache loaders or cache writers that are invoked during the operation.
Region::RemoveAPI removes the entry with specified key and provides a user-defined parameter object to any
CacheListenerinvoked in the process.
All data that GemFire moves out of the local cache must be serializable.
For region-level events, an application can use
AttributesFactory.SetCache*methods to implement and register the
ICacheListenerinterfaces to perform custom actions.
An example shows how to connect to GemFire, create a cache and region, put and get keys and values, and disconnect.
The .NET Framework does not find managed DLLs using the conventional
PATHenvironment variable. In order for your assembly to find and load a managed DLL, it must either be loaded as a private assembly using
assemblyBinding, or it must be installed into the Global Assembly Cache (GAC).