protected override void OverrideWithGroupPolicies(LoggingExceptionHandlerData configurationObject, IRegistryKey policyKey) { int? eventIdOverride = policyKey.GetIntValue(EventIdPropertyName); Type formatterTypeOverride = policyKey.GetTypeValue(FormatterTypePropertyName); String logCategoryOverride = policyKey.GetStringValue(LogCategoryPropertyName); int? priorityOverride = policyKey.GetIntValue(PriorityPropertyName); TraceEventType?severityOverride = policyKey.GetEnumValue <TraceEventType>(SeverityPropertyName); String titleOverride = policyKey.GetStringValue(TitlePropertyName); configurationObject.EventId = eventIdOverride.Value; configurationObject.FormatterType = formatterTypeOverride; configurationObject.LogCategory = logCategoryOverride; configurationObject.Priority = priorityOverride.Value; configurationObject.Severity = severityOverride.Value; configurationObject.Title = titleOverride; }
/// <summary> /// Overrides the <paramref name="configurationObject"/>'s properties with the Group Policy values from the /// registry. /// </summary> /// <param name="configurationObject">The configuration object for instances that must be managed.</param> /// <param name="policyKey">The <see cref="IRegistryKey"/> which holds the Group Policy overrides for the /// configuration element.</param> /// <remarks>Subclasses that manage custom provider's configuration objects with additional properties may /// override this method to override these properties.</remarks> protected override void OverrideWithGroupPolicies(T configurationObject, IRegistryKey policyKey) { Type providerTypeOverride = policyKey.GetTypeValue(ProviderTypePropertyName); String attributesOverride = policyKey.GetStringValue(AttributesPropertyName); configurationObject.Type = providerTypeOverride; configurationObject.Attributes.Clear(); Dictionary <String, String> attributesDictionary = new Dictionary <string, string>(); KeyValuePairParser.ExtractKeyValueEntries(attributesOverride, attributesDictionary); foreach (KeyValuePair <String, String> kvp in attributesDictionary) { configurationObject.Attributes.Add(kvp.Key, kvp.Value); } }