/// <summary>
 /// Инициализирует экземпляр <see cref="AsyncMethodCallState{TPipeline}"/>.
 /// </summary>
 public AsyncMethodCallState(
     IEnumerable <MethodBoundaryAspect> boundaryAspects,
     MethodInterceptionAspect interceptionAspect)
 {
     _boundaryAspects    = boundaryAspects;
     _interceptionAspect = interceptionAspect;
 }
示例#2
0
 public MethodCallState(
     MethodInterceptionAspect interceptionAspect,
     IEnumerable <MethodBoundaryAspect> boundaryAspects)
 {
     InterceptionAspect = interceptionAspect;
     BoundaryAspects    = boundaryAspects;
 }
示例#3
0
 /// <summary>
 /// Инициализирует экземпляр <see cref="EntryState{TPipeline}"/>.
 /// </summary>
 public EntryState(
     IEnumerable <MethodBoundaryAspect> boundaryAspects,
     MethodInterceptionAspect interceptionAspect)
     : base(boundaryAspects)
 {
     _interceptionAspect = interceptionAspect;
 }
        public IInvocationPipeline CreatePipeline(
            IInvocationSignature signature,
            MethodBoundaryAspect[] boundaryAspects,
            MethodInterceptionAspect interceptionAspect)
        {
            if (_cache.IsAsync(signature.TargetMethod))
            {
                return(new AsyncInvocationPipeline(signature, boundaryAspects, interceptionAspect));
            }

            return(new InvocationPipeline(signature, boundaryAspects, interceptionAspect));
        }
 /// <summary>
 /// Создает экземпляр <see cref="InvocationWeaveData"/> с признаком
 /// возможности применения аспектов.
 /// </summary>
 /// <param name="pipeline">Пайплайн.</param>
 /// <param name="pipelineExecutor">Компонент выполнения пайплайна.</param>
 /// <param name="boundaryAspects">Аспекты <see cref="MethodBoundaryAspect"/>.</param>
 /// <param name="interceptionAspect">Аспект <see cref="MethodInterceptionAspect"/>.</param>
 /// <returns>Экземляр <see cref="InvocationWeaveData"/>.</returns>
 internal static InvocationWeaveData Weavable(
     IInvocationPipeline pipeline,
     IInvocationPipelineExecutor pipelineExecutor,
     IReadOnlyCollection <MethodBoundaryAspect> boundaryAspects,
     MethodInterceptionAspect interceptionAspect)
 {
     return(new InvocationWeaveData
     {
         IsWeaveable = true,
         Pipeline = pipeline,
         PipelineExecutor = pipelineExecutor,
         BoundaryAspects = boundaryAspects,
         InterceptionAspect = interceptionAspect
     });
 }
        /// <summary>
        /// Инициализирует экземпляр <see cref="AsyncInvocationPipeline"/>.
        /// </summary>
        public AsyncInvocationPipeline(
            IInvocationSignature signature,
            IReadOnlyCollection <MethodBoundaryAspect> boundaryAspects,
            MethodInterceptionAspect interceptionAspect)
            : base(signature, boundaryAspects, interceptionAspect)
        {
            ReturnTypeInner = signature.InvocationType == InvocationType.AsyncFunction
                ? signature.Method.ReturnType.GetGenericArguments()[0]
                : null;

            CanReturnValue             = ReturnTypeInner != null;
            DefaultReturnValueProvider = new Lazy <object>(() => ReturnTypeInner != null
                ? ReturnTypeInner.GetDefaultValue()
                : null);
        }