/// <summary> /// 设置对象到请求唯一缓存 /// </summary> /// <param name="key"></param> /// <param name="theObject"></param> public static void SetToCallContext(ContextKey key, object theObject) { CallContext.SetData(key.Description(), theObject); }
/// <summary> /// 获取请求线程内的唯一缓存对象 /// </summary> public static T GetFromCallContext <T>(ContextKey key) { return((T)CallContext.GetData(key.Description())); }