/// <inheritdoc /> public IStashboxContainer RegisterDecorator <TTo>(Action <DecoratorConfigurator <TTo, TTo> > configurator = null) where TTo : class { this.ThrowIfDisposed(); var type = typeof(TTo); var decoratorConfigurator = new DecoratorConfigurator <TTo, TTo>(type, type); configurator?.Invoke(decoratorConfigurator); decoratorConfigurator.AsImplementedTypes(); return(this.RegisterInternal(decoratorConfigurator, true)); }
/// <inheritdoc /> public IStashboxContainer RegisterDecorator(Type typeTo, Action <DecoratorConfigurator> configurator = null) { this.ThrowIfDisposed(); Shield.EnsureNotNull(typeTo, nameof(typeTo)); var decoratorConfigurator = new DecoratorConfigurator(typeTo, typeTo); configurator?.Invoke(decoratorConfigurator); decoratorConfigurator.AsImplementedTypes(); if (!decoratorConfigurator.TypeMapIsValid(out var error)) { throw new InvalidRegistrationException(decoratorConfigurator.ImplementationType, error); } return(this.RegisterInternal(decoratorConfigurator, true)); }