コード例 #1
0
ファイル: TraceConfig.cs プロジェクト: zmyer/service-fabric
        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);
        }
コード例 #2
0
        private static void ParseConfigurationPackages(CodePackageActivationContext context, ServiceManifest manifest)
        {
            IList <string> names = context.GetConfigurationPackageNames();

            foreach (string name in names)
            {
                manifest.ConfigurationPackages.Add(context.GetConfigurationPackageObject(name));
            }
        }
コード例 #3
0
ファイル: ConfigHandler.cs プロジェクト: GitTorre/FailBrick
        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;
            }
        }