Пример #1
0
        public SprocketWTWContainer Register(Type typeToRegister, Type typeToBuild, LifetimeEnum lifetime)
        {
            var details = new RegistrationDetails
            {
                RegisteredType = typeToRegister,
                ResolvedType   = typeToBuild,
                Lifetime       = lifetime
            };

            _registrationCache.RegisterType(details);
            return(this);
        }
Пример #2
0
        public SprocketWTWContainer Register(Type typeToRegister, object instance)
        {
            var details = new RegistrationDetails
            {
                RegisteredType = typeToRegister,
                Lifetime       = LifetimeEnum.Singleton,
                IsCreated      = true
            };

            _registrationCache.RegisterType(details);
            _management.RegisterInstance(typeToRegister, instance);

            return(this);
        }
 public void RegisterType(RegistrationDetails details)
 {
     TypeRegistrations.Value.TryAdd(details.RegisteredType, details);
 }