예제 #1
0
        /// <summary>
        /// Starts scope.
        /// </summary>
        /// <returns><code>true</code> if scope has handler and it's start method returned true, <code>false</code> otherwise.</returns>
        public bool Start()
        {
            lock (SyncRoot) {
                bool result = false;
                if (IsEnabled && !IsRunning)
                {
                    if (HasHandler)
                    {
                        // Only start if scope handler allows it
                        try {
                            // If we dont have a handler of our own dont try to start it
                            if (_handler != null)
                            {
                                result = _handler.Start(this);
                            }
                        } catch (Exception ex) {
#if !SILVERLIGHT
                            log.Error("Could not start scope " + this, ex);
#endif
                        }
                    }
                    else
                    {
                        // Always start scopes without handlers
#if !SILVERLIGHT
                        log.Debug(string.Format("Scope {0} has no handler, allowing start.", this));
#endif
                        result = true;
                    }
                    _running = result;
                }
                return(result);
            }
        }
 public void Start()
 {
     AzureIdentityEventSource.Singleton.GetToken(_name, _context);
     _scopeHandler.Start(_name, _scope);
 }