예제 #1
0
 /// <summary>
 /// Gets internal object.
 /// </summary>
 /// <param name="alertUnnotifiedChanges">This method alerts unverified changes.</param>
 /// <exception cref="MemoryInjectionException" accessor="get">If the object has been changed after last stamp.</exception>
 private TObject GetObjectInternal(bool alertUnnotifiedChanges)
 {
     if (alertUnnotifiedChanges && CanAlert)
     {
         _injectionDetector.AlertUnnotifiedChanges(_object);
     }
     return(_object);
 }
        public object Provide()
        {
            var instance = GetInstance();

            if (_isFirstTime)
            {
                //Verify lazily when the first instance is requested.
                VerifyInstanceInternal(instance);
                _isFirstTime = false;
            }
            else
            {
                if (CanAlert && _injectionDetector.CanAlert)
                {
                    _injectionDetector.AlertUnnotifiedChanges(instance);
                }
            }
            return(instance);
        }