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