InstanceProducerImplementationType Property

Simple Injector
Gets the originally registered implementation type. Note that the actual type, returned by GetInstance, will be different from ImplementationType when decorators or interceptors are applied. This property will always return the originally registered implementation type. In case the implementation type is unknown, which happens for instance when registering FuncTResult delegates, the service type is returned.

Namespace:  SimpleInjector
Assembly:  SimpleInjector (in SimpleInjector.dll) Version: 5.3.0
Syntax

public Type ImplementationType { get; }

Property Value

Type: Type
The originally registered implementation type.
Examples

Given the configuration below, the Assert calls will succeed.
C#
var container = new Container();

container.Register<ILogger, ConsoleLogger>();
container.RegisterDecorator<ILogger, LoggerDecorator>();

var producer = container.GetRegistration(typeof(ILogger));

Assert.AreEqual(typeof(ConsoleLogger), producer.ImplementationType);
Assert.AreEqual(typeof(ConsoleLogger), producer.Registration.ImplementationType, "Before GetInstance");
Assert.AreEqual(typeof(LoggerDecorator), producer.GetInstance().GetType());
Assert.AreEqual(typeof(LoggerDecorator), producer.Registration.ImplementationType, "After GetInstance");
See Also

Reference