Exemple #1
0
        private void BindCore(Type type, string key, Func <ResolutionContext, object> provider, bool singleInstance)
        {
            RegistrationFlags flags = RegistrationFlags.None;

            if (singleInstance)
            {
                flags |= RegistrationFlags.SingleInstance;
            }

            var regKey       = new RegistrationKey(type, key);
            var registration = new Registration(type, key, provider, flags);

            _lock.EnterWriteLock();
            try
            {
                // note: replaces any existing bindings.
                _registrations[regKey] = registration;
            }
            finally
            {
                _lock.ExitWriteLock();
            }
        }
 public ActivationScope(ResolutionContext context, RegistrationKey regKey)
 {
     _context = context;
     _context._activationStack.Push(regKey);
 }
 public bool WouldCreateCycle(RegistrationKey reg)
 {
     return(_activationStack.Contains(reg));
 }
 public ActivationScope Activating(RegistrationKey regKey)
 {
     return(new ActivationScope(this, regKey));
 }