/// <summary>
 /// 移除代理者
 /// </summary>
 /// <param name="realObject">真实对象</param>
 public void RemoveProxyer(IAspectTrackObject realObject)
 {
     if (ProxyObjects.ContainsKey(realObject))
     {
         ProxyObjects.Remove(realObject);
     }
     if (Proxys.ContainsKey(realObject))
     {
         Proxys.Remove(realObject);
     }
 }
Example #2
0
 /// <summary>
 /// 获取代理者
 /// </summary>
 /// <param name="realObject">真实对象</param>
 /// <returns>代理者</returns>
 public object GetProxyer(IAspectTrackObject realObject)
 {
     if (_proxys.ContainsKey(realObject))
     {
         return(_proxys[realObject]);
     }
     else
     {
         GlobalTools.LogWarning("获取代理者失败:真实对象 " + realObject.ToString() + " 并不存在代理者!");
         return(null);
     }
 }
Example #3
0
 /// <summary>
 /// 获取代理对象
 /// </summary>
 /// <typeparam name="T">代理对象类型</typeparam>
 /// <param name="realObject">真实对象</param>
 /// <returns>代理对象</returns>
 public T GetProxyObject <T>(IAspectTrackObject realObject) where T : class, IAspectTrackObject
 {
     if (_proxyObjects.ContainsKey(realObject))
     {
         return(_proxyObjects[realObject] as T);
     }
     else
     {
         GlobalTools.LogWarning("获取代理对象失败:真实对象 " + realObject.ToString() + " 并不存在代理对象!");
         return(null);
     }
 }
 /// <summary>
 /// 获取代理者
 /// </summary>
 /// <param name="realObject">真实对象</param>
 /// <returns>代理者</returns>
 public object GetProxyer(IAspectTrackObject realObject)
 {
     if (_proxys.ContainsKey(realObject))
     {
         return(_proxys[realObject]);
     }
     else
     {
         GlobalTools.LogWarning(string.Format("获取代理者失败:真实对象 {0} 并不存在代理者!", realObject));
         return(null);
     }
 }
Example #5
0
        /// <summary>
        /// 创建代理者
        /// </summary>
        /// <typeparam name="T">代理对象类型</typeparam>
        /// <param name="proxyObject">代理者</param>
        /// <returns>代理对象</returns>
        public T CreateProxyer <T>(AspectProxyBase <T> proxyObject) where T : class, IAspectTrackObject
        {
            IAspectTrackObject proxyObj = proxyObject.GetTransparentProxy() as IAspectTrackObject;
            IAspectTrackObject realObj  = proxyObject.RealObject;

            if (!_proxyObjects.ContainsKey(realObj))
            {
                _proxyObjects.Add(realObj, proxyObj);
            }
            if (!_proxys.ContainsKey(realObj))
            {
                _proxys.Add(realObj, proxyObject);
            }

            return(proxyObj as T);
        }
Example #6
0
 /// <summary>
 /// 获取代理对象
 /// </summary>
 /// <typeparam name="T">代理对象类型</typeparam>
 /// <param name="realObject">真实对象</param>
 /// <returns>代理对象</returns>
 public T GetProxyObject <T>(IAspectTrackObject realObject) where T : class, IAspectTrackObject
 {
     return(_helper.GetProxyObject <T>(realObject));
 }
Example #7
0
 /// <summary>
 /// 移除代理者
 /// </summary>
 /// <param name="realObject">真实对象</param>
 public void RemoveProxyer(IAspectTrackObject realObject)
 {
     _helper.RemoveProxyer(realObject);
 }
Example #8
0
 /// <summary>
 /// 获取代理者
 /// </summary>
 /// <param name="realObject">真实对象</param>
 /// <returns>代理者</returns>
 public object GetProxyer(IAspectTrackObject realObject)
 {
     return(_helper.GetProxyer(realObject));
 }