/// <summary> /// 添加客户端代理 /// </summary> /// <param name="builder">服务构建者</param> /// <returns>服务构建者。</returns> public static IServiceBuilder AddClientProxy(this IServiceBuilder builder) { var services = builder.Services; services.RegisterType <ServiceProxyGenerater>().As <IServiceProxyGenerater>().SingleInstance(); services.RegisterType <ServiceProxyProvider>().As <IServiceProxyProvider>().SingleInstance(); builder.Services.Register(provider => new ServiceProxyFactory( provider.Resolve <IRemoteInvokeService>(), provider.Resolve <ITypeConvertibleService>(), provider.Resolve <IServiceProvider>(), builder.GetInterfaceService(), builder.GetDataContractName() )).As <IServiceProxyFactory>().SingleInstance(); return(builder); }