.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.

  • About the .NET Client API

    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.

  • Object Lifetimes

    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.

  • .NET Application Domains

    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.

  • Creating a Cache

    You create a cache using the GemFire CacheFactory.Create call. Cache creation initializes the distributed system and creates the cache using your geode.properties and cache.xml file settings and any additional properties you provide to the call.

  • Creating a Region

    To create a region, you create a RegionFactory using the RegionShortcut that most closely fits your region configuration.

  • Adding an Entry to the Cache

    You populate a native client region with cache entries by using the generic IDictionary API or by using the .NET Region.Put or the Region.Create API functions.

  • Accessing an Entry

    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.

  • Removing an Entry

    The standard Region::Remove API removes the entry with specified key and provides a user-defined parameter object to any CacheWriter or CacheListener invoked in the process.

  • Data Serialization

    All data that GemFire moves out of the local cache must be serializable.

  • Application Callbacks

    For region-level events, an application can use AttributesFactory.SetCache* methods to implement and register the ICacheLoader, ICacheWriter, and ICacheListener interfaces to perform custom actions.

  • A Simple C# Example

    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 using assemblyBinding, or it must be installed into the Global Assembly Cache (GAC).