Пример #1
0
        /// <inheritdoc />
        public IStashboxContainer ReMapDecorator(Type typeFrom, Type typeTo, Action <IFluentDecoratorRegistrator> configurator = null)
        {
            Shield.EnsureNotNull(typeFrom, nameof(typeFrom));
            Shield.EnsureNotNull(typeTo, nameof(typeTo));

            var context = new DecoratorRegistrationContext(new RegistrationContext(typeFrom, typeTo));

            configurator?.Invoke(context);
            return(this.ReMap(context.RegistrationContext, true));
        }
        /// <inheritdoc />
        public IStashboxContainer RegisterDecorator(Type typeFrom, Type typeTo, Action <IFluentDecoratorRegistrator> configurator = null)
        {
            Shield.EnsureNotNull(typeFrom, nameof(typeFrom));
            Shield.EnsureNotNull(typeTo, nameof(typeTo));

            var context = new DecoratorRegistrationContext(new RegistrationContext(typeFrom, typeTo));

            configurator?.Invoke(context);
            return(this.serviceRegistrator.Register(this.registrationBuilder.BuildServiceRegistration(context.RegistrationContext, true),
                                                    context.RegistrationContext));
        }