示例#1
0
        private void CreateFactory(ComponentRegistration key, Delegate @delegate, InstanceMode instanceMode)
        {
            IFactoryProvider factoryProvider = null;

            if (instanceMode == InstanceMode.Transient)
            {
                factoryProvider = new TransientFactory(@delegate);
            }

            if (instanceMode == InstanceMode.Singleton)
            {
                factoryProvider = new SingletonFactory(@delegate);
            }

            lock (syncLock)
            {
                components[key] = factoryProvider;
            }
        }
示例#2
0
 public Component ServiceFor <TInt, TCOMP>()
 {
     componentRegistration = new ComponentRegistration(typeof(TInt), typeof(TCOMP));
     return(this);
 }
示例#3
0
 public Component For <TCOMP>()
 {
     componentRegistration = new ComponentRegistration(typeof(TCOMP));
     return(this);
 }