Exemple #1
0
            void IRegistrationLocationSelectionSyntax <TComponent> .InsteadOf <TRegistrationType>()
            {
                if (newRegistration.ComponentType != typeof(TRegistrationType))
                {
                    registrations.EnsureNoDuplicateRegistrationType(newRegistration.ComponentType);
                }

                var registrationIndex = registrations.EnsureRegistrationExists <TRegistrationType>();

                registrations.entries[registrationIndex] = newRegistration;
            }
Exemple #2
0
            void ITrackingRegistrationLocationSelectionSyntax <TComponent> .InsteadOf <TRegistrationType>()
            {
                if (newRegistration.ComponentType != typeof(TRegistrationType))
                {
                    registrations.EnsureNoDuplicateRegistrationType(newRegistration.ComponentType);
                }

                var registrationIndex     = registrations.EnsureRegistrationExists <TRegistrationType>();
                var innerComponentFactory = registrations.entries[registrationIndex].Factory;

                registrations.entries[registrationIndex] = new LazyComponentRegistration(
                    newRegistration.ComponentType,
                    arg => newRegistration.Factory(innerComponentFactory(arg), arg)
                    );
            }