Exemplo n.º 1
0
 /// <summary>
 /// Gets the instance of the standalone Umbraco application.
 /// </summary>
 public static StandaloneApplication GetApplication(string baseDirectory)
 {
     lock (AppLock)
     {
         return(_application ?? (_application = new StandaloneApplication(baseDirectory)));
     }
 }
Exemplo n.º 2
0
        public ServiceContextManager(string connectionString, string providerName, string baseDirectory)
        {
            _connectionString = connectionString;
            _providerName     = providerName;

            Trace.WriteLine("Current AppDomain: " + AppDomain.CurrentDomain.FriendlyName);
            Trace.WriteLine("Current AppDomain: " + AppDomain.CurrentDomain.BaseDirectory);

            _application = StandaloneApplication.GetApplication(baseDirectory);
            _application.Start();
        }
Exemplo n.º 3
0
        public void Terminate(bool noerr = false)
        {
            lock (AppLock)
            {
                if (_started == false)
                {
                    if (noerr)
                    {
                        return;
                    }
                    throw new InvalidOperationException("Application has already been terminated.");
                }

                ApplicationContext.Current.DisposeIfDisposable(); // should reset resolution, clear caches & resolvers...
                ApplicationContext.Current = null;
                UmbracoContext.Current.DisposeIfDisposable();     // dunno
                UmbracoContext.Current = null;

                _started     = false;
                _application = null;
            }
        }