Ejemplo n.º 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();
            }
        }
Ejemplo n.º 2
0
 public ActivationScope(ResolutionContext context, RegistrationKey regKey)
 {
     _context = context;
     _context._activationStack.Push(regKey);
 }
Ejemplo n.º 3
0
 public bool WouldCreateCycle(RegistrationKey reg)
 {
     return(_activationStack.Contains(reg));
 }
Ejemplo n.º 4
0
 public ActivationScope Activating(RegistrationKey regKey)
 {
     return(new ActivationScope(this, regKey));
 }