.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.
C++ Class to .NET Class Mappings
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.
Java to .NET Type Mapping Table
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
AppDomain
s, 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.Create
call. Cache creation initializes the distributed system and creates the cache using yourgeode.properties
andcache.xml
file settings and any additional properties you provide to the call. -
To create a region, you create a
RegionFactory
using theRegionShortcut
that most closely fits your region configuration. -
You populate a native client region with cache entries by using the generic
IDictionary
API or by using the .NETRegion.Put
or theRegion.Create
API functions. -
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.
-
The standard
Region::Remove
API removes the entry with specified key and provides a user-defined parameter object to anyCacheWriter
orCacheListener
invoked 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 theICacheLoader
,ICacheWriter
, andICacheListener
interfaces 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.
Troubleshooting .NET Applications
The .NET Framework does not find managed DLLs using the conventional
PATH
environment variable. In order for your assembly to find and load a managed DLL, it must either be loaded as a private assembly usingassemblyBinding
, or it must be installed into the Global Assembly Cache (GAC).