예제 #1
0
        public InterceptedInput(IFunction function, InterceptedMethodDescriptor method, IInvocation invocation)
            : base(function)
        {
            Method      = method;
            Invocation  = invocation;
            ProceedInfo = invocation.CaptureProceedInfo();

            var arguments        = invocation.Arguments;
            var argumentHandlers = method.ArgumentHandlers;
            var preprocessingArgumentHandlers = method.PreprocessingArgumentHandlers;

            if (preprocessingArgumentHandlers != null)
            {
                foreach (var(handler, index) in preprocessingArgumentHandlers)
                {
                    handler.PreprocessFunc !.Invoke(method, invocation, index);
                }
            }

            var hashCode = System.HashCode.Combine(
                HashCode,
                method.InvocationTargetHandler.GetHashCodeFunc(invocation.InvocationTarget));

            for (var i = 0; i < arguments.Length; i++)
            {
                hashCode ^= argumentHandlers[i].GetHashCodeFunc(arguments[i]);
            }
            HashCode = hashCode;
        }
예제 #2
0
 public ComputeServiceFunctionBase(
     InterceptedMethodDescriptor method,
     Generator <LTag> versionGenerator,
     IServiceProvider serviceProvider,
     ILogger <ComputeServiceFunction <T> >?log = null)
     : base(method, serviceProvider)
 {
     Log = log ??= NullLogger <ComputeServiceFunction <T> > .Instance;
     VersionGenerator = versionGenerator;
 }
 public AsyncComputeServiceFunction(
     InterceptedMethodDescriptor method,
     Generator <LTag> versionGenerator,
     IServiceProvider serviceProvider,
     ILogger <ComputeServiceFunction <T> >?log = null)
     : base(method, versionGenerator, serviceProvider, log)
 {
     if (!method.Options.IsAsyncComputed)
     {
         throw Stl.Internal.Errors.InternalError(
                   $"This type shouldn't be used with {nameof(ComputedOptions)}.{nameof(ComputedOptions.IsAsyncComputed)} == false option.");
     }
 }
 protected InterceptedFunctionBase(InterceptedMethodDescriptor method, IServiceProvider serviceProvider)
     : base(serviceProvider)
 {
     Method  = method;
     Options = method.Options;
 }