Beispiel #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;
            }
Beispiel #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)
                    );
            }
Beispiel #3
0
 void IRegistrationLocationSelectionSyntax <TComponent> .OnBottom()
 {
     registrations.EnsureNoDuplicateRegistrationType(newRegistration.ComponentType);
     registrations.entries.Add(newRegistration);
 }