protected CallbackBase(long id, ICallbackExecutor <TMarshal> executor, BindingDelegate <TMarshal> parameterBinder, Type resultType) { this.id = id; this.executor = executor; this.parameterBinder = parameterBinder; this.resultType = resultType; }
public Delegate Generate(Type delegateType, long id, ICallbackExecutor <TMarshal> callbackExecutor, BindingDelegate <TMarshal> parameterBinder) { ValidateDelegateType(delegateType); if (!typeCache.TryGetValue(delegateType, out var delegateContainerType)) { delegateContainerType = GenerateDelegateContainerType(delegateType); typeCache.Add(delegateType, delegateContainerType); } var created = Activator.CreateInstance(delegateContainerType, id, callbackExecutor, parameterBinder, delegateType); return(Delegate.CreateDelegate(delegateType, created, DelegateMethodName, false, true));; }
public CallbackFactory(ICallbackExecutor <TMarshal> callbackExecutor) { this.callbackExecutor = callbackExecutor; }
public TestCallback(long id, ICallbackExecutor <object> executor, BindingDelegate <object> parameterBinder, Type resultType) : base(id, executor, parameterBinder, resultType) { }
private void Sun(ICallbackExecutor <object> callbackExecutor) { new DelegateContainerBase <object>(1, callbackExecutor, ctx => { }, typeof(object), typeof(Action)); }
public DelegateContainerBase(long id, ICallbackExecutor <TMarshal> executor, BindingDelegate <TMarshal> parameterBinder, Type resultType, Type delegateType) : base(id, executor, parameterBinder, resultType) { bindValues = delegateType.GetMethod(nameof(Action.Invoke)).GetParameters() .Select(p => p.GetCustomAttribute <BindValueAttribute>()).ToArray(); }
public Callback(long id, ICallbackExecutor <TMarshal> executor, BindingDelegate <TMarshal> parameterBinder) : base(id, executor, parameterBinder, typeof(object)) { }
public void Consume <S, T>(string routeKey, ICallbackExecutor executor) where S : IServiceDefinition, new() { _catalog[typeof(T).FullName] = executor; _consumeRoutes.Add <S, T>(routeKey); }
public void Consume <T>(ICallbackExecutor executor) => _catalog[typeof(T).FullName] = executor;