示例#1
0
        /// <summary>
        /// Return a <see cref="IResolverPolicy"/> that can be used to give a value
        /// for the given desired dependency.
        /// </summary>
        /// <param name="builderContext">Current build context.</param>
        /// <param name="dependencyType">Type of dependency desired.</param>
        /// <returns>a <see cref="IResolverPolicy"/> object if this override applies, null if not.</returns>
        public override IResolverPolicy GetResolver(IBuilderContext builderContext, Type dependencyType)
        {
            var context = builderContext ?? throw new ArgumentNullException(nameof(builderContext));

            if (context.CurrentOperation is BuildOperation operation &&
                operation.TypeBeingConstructed == _targetType)
            {
                return(_innerOverride.GetResolver(context, dependencyType));
            }

            return(null);
        }
示例#2
0
 public override ResolveDelegate <TContext> GetResolver <TContext>(Type type)
 {
     return(_innerOverride.GetResolver <TContext>(type));
 }