示例#1
0
        // Convenience...
        protected void BindImplementationToSpecificService(Container container, Type implementationType, Type serviceType, string key)
        {
            if (serviceType.IsGenericTypeDefinition)
            {
                var unboundGeneric = new UnboundGeneric(serviceType, implementationType, container, this.RegistrationFactory);
                container.AddUnboundGeneric(new TypeKey(serviceType.TypeHandle, key), unboundGeneric);
            }
            else
            {
                var creator      = new TypeCreator(implementationType, container);
                var registration = this.CreateRegistration(container, creator);

                container.AddRegistration(new TypeKey(serviceType.TypeHandle, key ?? creator.AttributeKey), registration);
            }
        }
示例#2
0
        // Convenience...
        protected void BindImplementationToSpecificService(Container container, Type implementationType, Type serviceType, string key)
        {
            if (serviceType.IsGenericTypeDefinition)
            {
                var unboundGeneric = new UnboundGeneric(serviceType, implementationType, container, this.RegistrationFactory);
                container.AddUnboundGeneric(new TypeKey(serviceType.TypeHandle, key), unboundGeneric);
            }
            else
            {
                var creator = new TypeCreator(implementationType, container);
                var registration = this.CreateRegistration(container, creator);

                container.AddRegistration(new TypeKey(serviceType.TypeHandle, key ?? creator.AttributeKey), registration);
            }
        }