public static TInterface CreateInterfaceProxy <TInterface>(Usr usr) where TInterface : class { ProxyGenerator generator = new ProxyGenerator(); string tname = typeof(TInterface).Name; NameValueCollection mgrs = (NameValueCollection)ConfigurationManager.GetSection("ManagerGroup/Interface"); string implName = mgrs[tname]; if (StringUtil.isEmpty(implName)) { implName = tname.Substring(1); } string nms = ConfigurationManager.AppSettings["mgrImplNamespace"]; string implFullName = nms + "." + implName; int? connId = ConnectorFactory.GenConnector(); if (null == connId) { return(null); } TInterface target = (TInterface)Activator.CreateInstance(Type.GetType(implFullName), new object[] { connId }); return(generator.CreateInterfaceProxyWithTarget <TInterface>(target, new MgrInterceptor(connId, implFullName))); }