public static IServiceCollection AddProxy(this IServiceCollection serviceCollection, IRpcServiceProvider rpcServiceProvider) { var serviceDict = rpcServiceProvider.ScanRpcServices(); foreach (var rpcServiceInfo in serviceDict) { MethodInfo mi = typeof(ProxyHelper).GetMethod("Proxy").MakeGenericMethod(rpcServiceInfo.Value.ServiceType); serviceCollection.AddSingleton(rpcServiceInfo.Value.ServiceType, mi.Invoke(null, null)); } return(serviceCollection); }
public SimpleRpcServiceContainer(IRpcServiceProvider rpcServiceProvider) { this.rpcServiceProvider = rpcServiceProvider; this.BuildRpcService(); }