From e4387b8daebd6e23a34de30f57cb2c4c52ff72d6 Mon Sep 17 00:00:00 2001 From: Morten Christensen Date: Tue, 25 Jun 2013 13:43:57 +0200 Subject: [PATCH] Adding some internal bits in the ServiceContextManager and PackagingService --- src/Umbraco.Core/Services/PackagingService.cs | 11 +++++++++++ .../Standalone/ServiceContextManager.cs | 14 +++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Core/Services/PackagingService.cs b/src/Umbraco.Core/Services/PackagingService.cs index 29a0dfcac2..0c71e78c53 100644 --- a/src/Umbraco.Core/Services/PackagingService.cs +++ b/src/Umbraco.Core/Services/PackagingService.cs @@ -45,6 +45,17 @@ namespace Umbraco.Core.Services _importedContentTypes = new Dictionary(); } + #region Generic export methods + + internal void ExportToFile(string absoluteFilePath, string nodeType, int id) + { + var contentType = _contentTypeService.GetContentType(id); + var xml = Export(contentType); + xml.Save(absoluteFilePath); + } + + #endregion + #region Content /// diff --git a/src/Umbraco.Core/Standalone/ServiceContextManager.cs b/src/Umbraco.Core/Standalone/ServiceContextManager.cs index ea9464242b..579bde0ff2 100644 --- a/src/Umbraco.Core/Standalone/ServiceContextManager.cs +++ b/src/Umbraco.Core/Standalone/ServiceContextManager.cs @@ -1,6 +1,5 @@ using System; using System.Diagnostics; -using System.Reflection; using Umbraco.Core.Persistence; using Umbraco.Core.Persistence.Mappers; using Umbraco.Core.Persistence.UnitOfWork; @@ -24,10 +23,19 @@ namespace Umbraco.Core.Standalone Trace.WriteLine("ServiceContextManager-Current AppDomain: " + AppDomain.CurrentDomain.FriendlyName); Trace.WriteLine("ServiceContextManager-Current AppDomain: " + AppDomain.CurrentDomain.BaseDirectory); - var examineEventHandlerToRemove = Type.GetType("Umbraco.Web.Search.ExamineEvents, Umbraco.Web"); + //var webAssembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(x => x.FullName.StartsWith("umbraco")); + //if (webAssembly != null && examineEventHandlerToRemove == null) + //{ + // var examineEventType = webAssembly.GetType("Umbraco.Web.Search.ExamineEvents"); + // examineEventHandlerToRemove = examineEventType; + //} _application = StandaloneCoreApplication.GetApplication(baseDirectory); - _application.WithoutApplicationEventHandler(examineEventHandlerToRemove); + + var examineEventHandlerToRemove = Type.GetType("Umbraco.Web.Search.ExamineEvents, umbraco"); + if (examineEventHandlerToRemove != null) + _application.WithoutApplicationEventHandler(examineEventHandlerToRemove); + _application.Start(); }