using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AustinHarris.JsonRpc
{
///
/// Provides access to a context specific to each JsonRpc method invocation.
/// This is a convienence class that wraps calls to Context specific methods on AustinHarris.JsonRpc.Handler
///
public class JsonRpcContext
{
private JsonRpcContext(object value)
{
Value = value;
}
///
/// The data associated with this context.
///
public object Value { get; private set; }
///
/// Allows you to set the exception used in in the JsonRpc response.
/// Warning: Must be called from within the execution context of the jsonRpc method to function.
///
///
public static void SetException(JsonRpcException exception)
{
Handler.RpcSetException(exception);
}
///
/// Must be called from within the execution context of the jsonRpc Method to return the context
///
///
public static JsonRpcContext Current()
{
return new JsonRpcContext(Handler.RpcContext());
}
}
}