public static void ApplyConfiguration() { // Apply database configuration ConfigurationSection sqlDbConfiguration = TridionConfig.ConfigurationManager.TryGetSection(DbConfiguration.SectionName); // Use reflection because SDL 2011 and SDL 2013 have different configuration structures Action <String, Object> setProperty = (Action <String, Object>)Delegate.CreateDelegate(typeof(Action <String, Object>), sqlDbConfiguration, typeof(ConfigurationElement).GetProperty("Item", BindingFlags.Instance | BindingFlags.NonPublic, null, typeof(Object), new Type[] { typeof(String) }, new ParameterModifier[] { }) .GetSetMethod(true)); if (sqlDbConfiguration != null) { setProperty("name", DebuggerConfig.Instance.Database.Name); setProperty("server", DebuggerConfig.Instance.Database.Server); setProperty("username", DebuggerConfig.Instance.Database.Username); setProperty("password", DebuggerConfig.Instance.Database.Password); } // Configure TRIDION_CM_HOME for the SchemaCache to find the required XSD files String rendererFolder = Path.GetFullPath(Path.Combine(ApplicationPath, DebuggerConfig.Instance.Templating.SchemaCache)); Environment.SetEnvironmentVariable("TRIDION_CM_HOME", rendererFolder); // Enable impersonation for the current windows user? if (DebuggerConfig.Instance.Templating.EnableImpersonation) { ContentManagerSecurityConfiguration section = TridionConfig.ConfigurationManager.TryGetSection(ContentManagerSecurityConfiguration.SectionName) as ContentManagerSecurityConfiguration; if (section != null) { section.ImpersonationUsers.Add( new ImpersonationUserSettings() { Name = WindowsIdentity.GetCurrent().Name, ImpersonationType = ImpersonationType.Windows }); } } // Enable templating settings and load the WrappedMediator TemplatingSettings templatingSettings = TemplateUtilities.GetTemplatingSettings(); if (templatingSettings != null) { templatingSettings.DebuggingElement.PdbLocation = ApplicationPath; MediatorElement mediatorElement = templatingSettings.MediatorCollection .Cast <MediatorElement>() .FirstOrDefault(me => String.Equals(me.MatchMimeType, "text/x-tcm-csharpfragment")); if (mediatorElement != null) { // Ensure the wrapped mediator is initialized (this loads the configured debug libraries) WrappedCSharpMediator.Initialize(); mediatorElement.ClassName = typeof(WrappedCSharpMediator).AssemblyQualifiedName; } } }
public void Configure(MediatorElement configuration) { Dictionary<string, string> pars = new Dictionary<string, string>(); foreach (ParameterElement pe in configuration.ParameterCollection) { pars.Add(pe.Name, pe.Value); } if (pars.Count > 0) { if (pars[CONF_LOAD].ToLower() == Boolean.TrueString.ToLower()) { Logger.Info("XSLT Mediator is configured to load xslt helpers from assembly stored in Tridion"); m_HelperInterface = pars[CONF_INTERFACE]; m_HelpersAssemblyTBB = pars[CONF_TBB]; Logger.Debug(String.Format("XSLT Mediator will look for classes implementing '{0}' in assembly TBB: '{1}'", m_HelperInterface, m_HelpersAssemblyTBB)); } else Logger.Debug("XSLT Mediator is not configured to use helpers stored in Tridion"); } }
/// <summary> /// Configures the specified configuration. /// </summary> /// <param name="configuration">The configuration.</param> public void Configure(MediatorElement configuration) { mOriginalMediator.Configure(configuration); }
/// <summary> /// Configure the mediator object, based on the configuration element of the mediator. /// </summary> /// <param name="configuration">The MediatorElement configuration.</param> public void Configure(MediatorElement configuration) { _config = RazorMediatorConfigurationSection.GetConfiguration(); }