public void StartApplication()
        {
            //Ensure that the Umbraco.VisualStudio.dll is available in the solution's bin folder
            var mainAssemblyDestinationPath = Path.Combine(_projectBinFolder, AssemblyFileName);

            if (File.Exists(mainAssemblyDestinationPath) == false)
            {
                var mainAssemblySourcePath = GetAssemblyLocation(AssemblyFileName);
                File.Copy(mainAssemblySourcePath, mainAssemblyDestinationPath);
            }
            //Load the ServiceBridge in a sandboxed appdomain using the directory/context of the solution
            var           assemblyLocation = Path.Combine(_projectBinFolder, "Umbraco.Core.dll");
            ServiceBridge loader           = ServiceBridge.Sandbox(assemblyLocation, _configurationFile, CurrentDomain_AssemblyResolve);

            _bridge = loader;
            if (_bridge == null)
            {
                return;
            }

            _bridge.Configure(_connectionString, _providerName, _projectFolder);

            SetupMethodShortcuts();

            IsReady = true;
        }
        public void StartApplication()
        {
            //var domainSetup = new AppDomainSetup()
            //                      {
            //                          ApplicationBase = _projectBinFolder,
            //                          ConfigurationFile = _configurationFile,
            //                          ApplicationName =
            //                              AppDomain.CurrentDomain.SetupInformation.ApplicationName,
            //                          LoaderOptimization = LoaderOptimization.MultiDomainHost
            //                      };
            //var baseEvidence = AppDomain.CurrentDomain.Evidence;
            //var evidence = new Evidence(baseEvidence);
            //var childDomain = AppDomain.CreateDomain(AppDomainName, evidence, domainSetup);
            //childDomain.SetData("DataDirectory", _projectAppDataFolder);

            //var assemblyLocation = Path.Combine(_projectBinFolder, AssemblyFileName); //GetAssemblyLocation(AssemblyFileName);
            //var proxy = childDomain.CreateInstanceFromAndUnwrap(assemblyLocation, typeof(ServiceBridge).FullName);
            //_bridge = proxy as IServiceBridge;

            //Evidence adevidence = AppDomain.CurrentDomain.Evidence;
            //var newAppDomain = AppDomain.CreateDomain(AppDomainName, adevidence, _projectBinFolder, _projectBinFolder, true);
            //newAppDomain.SetData("DataDirectory", _projectAppDataFolder);
            //var assemblyLocation = Path.Combine(_projectBinFolder, AssemblyFileName);
            ////var unwrapped = newAppDomain.CreateInstanceFromAndUnwrap(assemblyLocation, typeof(ServiceBridge).FullName);
            //var unwrapped = newAppDomain.CreateInstanceFromAndUnwrap(assemblyLocation, typeof(ServiceBridge).FullName, false, BindingFlags.Default, null, null, CultureInfo.InvariantCulture, null);
            //_bridge = unwrapped as ServiceBridge;

            var           assemblyLocation = /*GetAssemblyLocation(AssemblyFileName);*/ Path.Combine(_projectBinFolder, "Umbraco.Core.dll");
            ServiceBridge loader           = ServiceBridge.Sandbox(assemblyLocation, _configurationFile, CurrentDomain_AssemblyResolve);

            _bridge = loader;
            if (_bridge == null)
            {
                return;
            }

            _connectionString = @"Data Source=C:\Temp\Playground\Umb610TestSiteVsPlugin\Umb610TestSiteVsPlugin\App_Data\Umbraco.sdf";
            _providerName     = "System.Data.SqlServerCe.4.0";
            _bridge.Configure(_connectionString, _providerName, _projectFolder);

            _methods = new Dictionary <string, Func <Dictionary <int, Dictionary <string, string> > > >
            {
                { "content", _bridge.GetRootContent },
                { "media", _bridge.GetRootMedia },
                { "contentTypes", _bridge.GetRootContentTypes },
                { "mediaTypes", _bridge.GetRootMediaTypes }
            };

            _methodsById = new Dictionary <string, Func <int, Dictionary <int, Dictionary <string, string> > > >
            {
                { "content", _bridge.GetChildContent },
                { "media", _bridge.GetChildMedia },
                { "contentTypes", _bridge.GetChildContentTypes },
                { "mediaTypes", _bridge.GetChildMediaTypes }
            };

            IsReady = true;
        }