Exemplo n.º 1
0
        private void RegisterConventions()
        {
            foreach (KeyValuePair <Type, HashSet <Type> > typeMapping in internalTypeMapping)
            {
                if (typeMapping.Value.Count == 1)
                {
                    Type type = typeMapping.Value.First();

                    this.container.RegisterType(typeMapping.Key, type);
                }
                else
                {
                    foreach (Type type in typeMapping.Value)
                    {
                        ServiceUnityRegistration attributes      = this.GetAttributes(type);
                        LifetimeManager          lifeTimeManager = CreateLifetimeManager(attributes);
                        this.container.RegisterType(typeMapping.Key, type, attributes.ContractName, lifeTimeManager, new InjectionMember[] {});
                    }
                }
            }
        }
Exemplo n.º 2
0
        public static LifetimeManager CreateLifetimeManager(ServiceUnityRegistration type)
        {
            Func <ServiceUnityRegistration, LifetimeManager> factory = lifetimeManagers[type.Lifetime];

            return(factory(type));
        }