public void Handle(ResolveUnregisteredInterfaceContext context)
 {
     CallCount++;
     context.SetInterfaceImplementationType(typeof(Service));
     context.CacheImplementation = Cache;
     context.CacheScope          = ComponentScope.Singleton;
 }
Esempio n. 2
0
        /// <summary>
        /// Handles the resolving of an unregistered interface.
        /// </summary>
        public void Handle(ResolveUnregisteredInterfaceContext context)
        {
            if (context is null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var attribute = context.InterfaceType.GetCustomAttribute <FallbackImplementationAttribute>();

            if (attribute != null)
            {
                context.SetInterfaceImplementationType(attribute.Type);
                context.CacheImplementation = true;
                context.CacheScope          = ComponentScope.Singleton;
            }
        }