Beispiel #1
0
        public void Load(IEnumerable <DependencyRegistration> registrations)
        {
            foreach (DependencyRegistration registration in registrations)
            {
                if (mContainer.CanResolve(registration.Target))
                {
                    continue;
                }

                if (registration.AsImplementationType != null)
                {
                    mContainer.Register(registration.Target, registration.AsImplementationType)
                    .WithScopeFromRegistrationInfo(registration);
                }
                else if (registration.AsProvider != null)
                {
                    mContainer.RegisterWithProviderType(registration.Target,
                                                        registration.AsProvider,
                                                        this).WithScopeFromRegistrationInfo(registration);
                }
                else if (registration.AsProviderInstance != null)
                {
                    mContainer.RegisterWithProviderInstance(registration.Target,
                                                            registration.AsProviderInstance as IDependencyProvider,
                                                            this).WithScopeFromRegistrationInfo(registration);
                }
                else if (registration.AsInstance != null)
                {
                    mContainer.Register(registration.Target, registration.AsInstance);
                }
            }
        }