Distributed context configuration is used when multiple applications or clients are accessing the same data. Typical uses for this is when web applications are deployed in multiple instances under load balancing, or for example with mobile/remote clients.

When distributed context is used, the first step is to create a ServerContext instance, with following constructor:

ServerContext(Context localContext)

Required parameter for this is a local context, which is just a plain Context.
Then, by using a technology of your choice, this ServerContext is wrapped as an application which can process remote calls. There is an example by using .NET remoting, but should also be possible via WCF.

On the client side, ClientContext is initialized, with following constructor:
ClientContext(IServerContext serverContext, IKeyValueStorage<Guid, object> localStorage)

First argument is a IServerContext implementation, which is a remote-call proxy to real ServerContext. Second is the local storage, which is used as local data read cache.

After this, you may open Workspace from ClientContext and perform Commit/Update the same way as you would with local Context.

For complete working example of distributed context via .NET remoting, see projects under Examples/Distributed in the source tree.

Last edited Mar 7, 2012 at 1:56 PM by nenadsabo, version 1


No comments yet.