• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Sholtee / injector / 2251

27 Dec 2023 10:00AM UTC coverage: 90.723% (-2.0%) from 92.704%
2251

push

appveyor

Sholtee
Merge branch 'drop_opencover'

2171 of 2393 relevant lines covered (90.72%)

0.91 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.5
/SRC/Injector/Private/Interception/InterceptorAggregator.cs
1
/********************************************************************************
2
* AspectAggregator.cs                                                           *
3
*                                                                               *
4
* Author: Denes Solti                                                           *
5
********************************************************************************/
6
using System;
7

8
namespace Solti.Utils.DI.Internals
9
{
10
    using Interfaces;
11
    using Proxy;
12

13
    //                                        !!!ATTENTION!!!
14
    //
15
    // This class is a critical component therefore every modification should be done carefully, with
16
    // performance in mind.
17
    // - NO System.Linq
18
    // - NO System.Reflection
19
    // - After ANY modifications, run the unit & performance tests to verify there is no regression
20
    //
21

22
    /// <summary>
23
    /// Aggregates <typeparamref name="TTarget"/> (class or interface) aspects to reduce the number of interceptors to be built.
24
    /// </summary>
25
    public class InterceptorAggregator<TInterface, TTarget> : InterfaceInterceptor<TInterface, TTarget>, IInterceptorAggregator where TTarget : class, TInterface where TInterface : class
26
    {
27
        private readonly IInterfaceInterceptor[] FInterceptors;
28

29
        /// <summary>
30
        /// Creates a new <see cref="InterceptorAggregator{TInterface, TTarget}"/> instance.
31
        /// </summary>
32
        public InterceptorAggregator(TTarget target, params IInterfaceInterceptor[] interceptors) : base(target) =>
1✔
33
            FInterceptors = interceptors ?? throw new ArgumentNullException(nameof(interceptors));
×
34

35
        /// <summary>
36
        /// Dispatches the invocation to the corresponding aspects
37
        /// </summary>
38
        public sealed override object? Invoke(InvocationContext context) => IInvocationContextFactory
1✔
39
            .Create(context, this)
1✔
40
            .InvokeInterceptor();
1✔
41

42
        /// <summary>
43
        /// Returns the bound interceptors.
44
        /// </summary>
45
        IInterfaceInterceptor[] IInterceptorAggregator.Interceptors => FInterceptors;
1✔
46

47
        object? IInterceptorAggregator.Target => Target;
1✔
48

49
        object? IInterceptorAggregator.CallTarget(InvocationContext ctx) => base.Invoke(ctx);
1✔
50
    }
51
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc