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