Example #1
0
 public RemoteActionContract(IRPC rpc, Tag targetTag, string controllerName, string name, bool noArgument = false)
 {
     _controllerName = controllerName;
     Name            = name;
     _targetTag      = targetTag;
     _rpc            = rpc;
     NoArgument      = noArgument;
 }
Example #2
0
        /// <summary>
        /// 使用自定义的RPC方案
        /// </summary>
        /// <param name="Services"></param>
        /// <param name="assembly">Assembly下所有接口都会自动被添加</param>
        /// <param name="rpc"></param>
        /// <returns></returns>
        /// <remarks>
        /// 将其它微服务的Service注入进来,然后可以像本地Service一样使用
        /// </remarks>
        public static IServiceCollection UseRPC(this IServiceCollection Services, Assembly assembly, IRPC rpc)
        {
            var builder = assembly.Proxy();
            var list    = assembly.GetTypes().Where(o => o.IsInterface && o.IsPublic);

            foreach (var item in list)
            {
                var proxy = builder.DefineType(item);
                Services.AddSingleton(item, proxy);
            }
            return(Services);
        }
Example #3
0
        static IServiceCollection UseRPC(this IServiceCollection Services, Type type, IRPC rpc)
        {
            var res = _proxyGenerator.CreateInterfaceProxyWithoutTarget(type, rpc);

            Services.AddSingleton(type, res);
            return(Services);
        }
Example #4
0
 /// <summary>
 /// 使用自定义的RPC方案
 /// </summary>
 /// <param name="Services"></param>
 /// <param name="rpc"></param>
 /// <returns></returns>
 /// <remarks>
 /// 将其它微服务的Service注入进来,然后可以像本地Service一样使用
 /// </remarks>
 public static IServiceCollection UseRPC <T>(this IServiceCollection Services, IRPC rpc)
 {
     return(Services.UseRPC(typeof(T), rpc));
 }
Example #5
0
 protected Accessor(IRPC rpc, IServerChooser chooser, string name)
 {
     _rpc = rpc;
     _chooser = chooser;
     _name = name;
 }
 public Classifier(IRPC rpc, IServerChooser chooser, string name)
     : base(rpc, chooser, name)
 {
 }
Example #7
0
 public virtual void Bind(IBindingContext context)
 {
     _rpc = context.RequireOne <IRPC>(this);
 }