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