using ServiceStack.ServiceHost;
namespace ServiceStack.Common
{
public static class RequestContextExtensions
{
///
/// Store an entry in the IHttpRequest.Items Dictionary
///
public static void SetItem(this IRequestContext requestContext, string key, object value)
{
if (requestContext == null) return;
var httpReq = requestContext.Get();
if (httpReq != null)
httpReq.Items[key] = value;
}
///
/// Get an entry from the IHttpRequest.Items Dictionary
///
public static object GetItem(this IRequestContext requestContext, string key)
{
if (requestContext == null) return null;
object value = null;
var httpReq = requestContext.Get();
if (httpReq != null)
httpReq.Items.TryGetValue(key, out value);
return value;
}
}
}