internal TraceConfig(string eventSourceName, string packageName) { this.traceEventsSectionName = string.Concat(TraceEventsSectionPrefix, eventSourceName); this.packageName = packageName; ConfigurationSettings configurationSettings = null; CodePackageActivationContext context = null; try { context = FabricRuntime.GetActivationContext(); } catch (Exception) { // We want to handle the standalone case } if (context != null) { // Handle scenario for System Servcies as they dont have config package. // System Services like Fault Analysis Service & Update Orchestration Service depends on Microsoft.ServiceFabric.Services.dll which depends on // Microsoft.ServiceFabric.Diagnostics.dll if (context.GetConfigurationPackageNames().Contains(packageName)) { var configPackage = context.GetConfigurationPackageObject(packageName); context.ConfigurationPackageModifiedEvent += this.OnConfigurationPackageModified; if (configPackage != null) { configurationSettings = configPackage.Settings; } } } this.UpdateSettings(configurationSettings, true); }
private static void ParseConfigurationPackages(CodePackageActivationContext context, ServiceManifest manifest) { IList <string> names = context.GetConfigurationPackageNames(); foreach (string name in names) { manifest.ConfigurationPackages.Add(context.GetConfigurationPackageObject(name)); } }
public ConfigHandler(CodePackageActivationContext activationcontext, string sectionName) { this.SectionName = sectionName; if (activationcontext.GetConfigurationPackageNames().Contains("Config")) { var configPackage = activationcontext.GetConfigurationPackageObject("Config"); this.UpdateConfigSettings(configPackage.Settings); activationcontext.ConfigurationPackageModifiedEvent += this.CodePackageActivationContext_ConfigurationPackageModifiedEvent; } }