Esempio n. 1
0
        /// <summary>
        /// 获取请求接口的实现对象
        /// </summary>
        /// <typeparam name="TInterface">请求接口</typeparam>
        /// <param name="host">服务跟路径,效果与HttpHostAttribute一致</param>
        /// <exception cref="ArgumentNullException"></exception>
        /// <exception cref="ArgumentException"></exception>
        /// <returns></returns>
        public TInterface GetHttpApi <TInterface>(string host) where TInterface : class
        {
            if (string.IsNullOrEmpty(host))
            {
                throw new ArgumentNullException();
            }

            if (typeof(TInterface).IsInterface == false)
            {
                throw new ArgumentException(typeof(TInterface).Name + "不是接口类型");
            }

            return(HttpApiClient.GeneratoProxy <TInterface>(host, this));
        }
Esempio n. 2
0
 /// <summary>
 /// 获取请求接口的实现对象
 /// </summary>
 /// <typeparam name="TInterface">请求接口</typeparam>
 /// <exception cref="ArgumentException"></exception>
 /// <returns></returns>
 public TInterface GetHttpApi <TInterface>() where TInterface : class
 {
     return(HttpApiClient.GeneratoProxy <TInterface>(null, this));
 }