public void Handle(ResolveUnregisteredInterfaceContext context) { CallCount++; context.SetInterfaceImplementationType(typeof(Service)); context.CacheImplementation = Cache; context.CacheScope = ComponentScope.Singleton; }
/// <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; } }