// A lock is only needed when the first time an instance is built
        internal override void DoBuildInstance(InjectionContext context, ParameterSet parameters, out T instance)
        {
            var injectionOperator = _builder.InjectionOperator;

            if (!ReferenceEquals(injectionOperator, this))
            {
                _builder.BuildInstance(context, parameters, out instance);
                return;
            }

            Monitor.Enter(_builder.ObjectRelation.SyncRoot);
            injectionOperator = _builder.InjectionOperator;
            if (!ReferenceEquals(injectionOperator, this))
            {
                Monitor.Exit(_builder.ObjectRelation.SyncRoot);
                _builder.BuildInstance(context, parameters, out instance);
                return;
            }

            try
            {
                var process = _configurationSet.CreateInjectionProcess <T>(context.Kernel);
                var oneoff  = new OneOffInjectionOperator <T>(_builder, _description, _lifetime, process);
                InjectionOperatorHelper.UpgradeToOneOffObjectBuilder(_builder, oneoff);
                oneoff.BuildInstance(context, parameters, out instance);
            }
            finally
            {
                Monitor.Exit(_builder.ObjectRelation.SyncRoot);
            }
        }
 public static void UpgradeToOneOffObjectBuilder <T>(ObjectBuilder <T> builder, OneOffInjectionOperator <T> oneoff)
 {
     builder.SetInjectionOperator(oneoff);
 }