protected override void AddElementAdministrativeTemplateParts(AdmContentBuilder contentBuilder,
                                                                      FormattedDatabaseTraceListenerData configurationObject,
                                                                      IConfigurationSource configurationSource,
                                                                      String elementPolicyKeyName)
        {
            List <AdmDropDownListItem> connectionStrings = new List <AdmDropDownListItem>();
            ConnectionStringsSection   connectionStringsSection
                = (ConnectionStringsSection)configurationSource.GetSection("connectionStrings");

            if (connectionStringsSection != null)
            {
                foreach (ConnectionStringSettings connectionString in connectionStringsSection.ConnectionStrings)
                {
                    connectionStrings.Add(new AdmDropDownListItem(connectionString.Name, connectionString.Name));
                }
            }
            contentBuilder.AddDropDownListPart(Resources.DatabaseTraceListenerDatabasePartName,
                                               DatabaseInstanceNamePropertyName,
                                               connectionStrings,
                                               configurationObject.DatabaseInstanceName);
            contentBuilder.AddEditTextPart(Resources.DatabaseTraceListenerWriteStoreProcPartName,
                                           WriteLogStoredProcNamePropertyName,
                                           configurationObject.WriteLogStoredProcName,
                                           512,
                                           true);
            contentBuilder.AddEditTextPart(Resources.DatabaseTraceListenerAddCategoryStoreProcPartName,
                                           AddCategoryStoredProcNamePropertyName,
                                           configurationObject.AddCategoryStoredProcName,
                                           512,
                                           false);
            AddTraceOptionsPart(contentBuilder, configurationObject.TraceOutputOptions);
            AddFilterPart(contentBuilder, configurationObject.Filter);
            AddFormattersPart(contentBuilder, configurationObject.Formatter, configurationSource);
        }
Ejemplo n.º 2
0
        // adds the admin parts that represent the properties of a
        // specific instance of the config element type managed by the reciever.
        //
        protected override void AddElementAdministrativeTemplateParts(AdmContentBuilder contentBuilder,
                                                                      RollOnceTraceListenerData configObj,
                                                                      IConfigurationSource configSource,
                                                                      string elementPolicyKeyName)
        {
            /* uses resources for these parts... */
            contentBuilder.AddEditTextPart("Filename",
                                           FilenamePropertyName,
                                           configObj.FileName,
                                           255,
                                           true);
            contentBuilder.AddEditTextPart("Header",
                                           HeaderPropertyName,
                                           configObj.Header,
                                           512,
                                           false);
            contentBuilder.AddEditTextPart("Footer",
                                           FooterPropertyName,
                                           configObj.Footer,
                                           512,
                                           false);
            contentBuilder.AddNumericPart("Max Logs",
                                          MaxLogsPropertyName,
                                          configObj.MaxLogs);

            AddTraceOptionsPart(contentBuilder, configObj.TraceOutputOptions);
            AddFilterPart(contentBuilder, configObj.Filter);
            AddFormattersPart(contentBuilder, configObj.Formatter, configSource);
        }
        /// <summary>
        /// Adds the ADM parts that represent the properties of
        /// a specific instance of the configuration element type managed by the receiver.
        /// </summary>
        /// <param name="contentBuilder">The <see cref="AdmContentBuilder"/> to which the Adm instructions are to be appended.</param>
        /// <param name="configurationObject">The configuration object instance.</param>
        /// <param name="configurationSource">The configuration source from where to get additional configuration
        /// information, if necessary.</param>
        /// <param name="elementPolicyKeyName">The key for the element's policies.</param>
        /// <remarks>
        /// Subclasses managing objects that must not create a policy will likely need to include the elements' keys when creating the parts.
        /// </remarks>
        protected override void AddElementAdministrativeTemplateParts(AdmContentBuilder contentBuilder,
                                                                      FormattedEventLogTraceListenerData configurationObject,
                                                                      IConfigurationSource configurationSource,
                                                                      String elementPolicyKeyName)
        {
            contentBuilder.AddEditTextPart(Resources.EventLogTraceListenerSourcePartName,
                                           SourcePropertyName,
                                           configurationObject.Source,
                                           255,
                                           true);

            contentBuilder.AddEditTextPart(Resources.EventLogTraceListenerLogPartName,
                                           LogPropertyName,
                                           configurationObject.Log,
                                           255,
                                           false);

            contentBuilder.AddEditTextPart(Resources.EventLogTraceListenerMachineNamePartName,
                                           MachineNamePropertyName,
                                           configurationObject.MachineName,
                                           255,
                                           false);

            AddTraceOptionsPart(contentBuilder, elementPolicyKeyName, configurationObject.TraceOutputOptions);

            AddFilterPart(contentBuilder, configurationObject.Filter);

            AddFormattersPart(contentBuilder, configurationObject.Formatter, configurationSource);
        }
        /// <summary>
        /// Adds the ADM parts that represent the properties of
        /// a specific instance of the configuration element type managed by the receiver.
        /// </summary>
        /// <param name="contentBuilder">The <see cref="AdmContentBuilder"/> to which the Adm instructions are to be appended.</param>
        /// <param name="configurationObject">The configuration object instance.</param>
        /// <param name="configurationSource">The configuration source from where to get additional configuration
        /// information, if necessary.</param>
        /// <param name="elementPolicyKeyName">The key for the element's policies.</param>
        /// <remarks>
        /// Subclasses managing objects that must not create a policy will likely need to include the elements' keys when creating the parts.
        /// </remarks>
        protected override void AddElementAdministrativeTemplateParts(AdmContentBuilder contentBuilder,
                                                                      FaultContractExceptionHandlerData configurationObject,
                                                                      IConfigurationSource configurationSource,
                                                                      String elementPolicyKeyName)
        {
            contentBuilder.AddTextPart(String.Format(CultureInfo.CurrentCulture,
                                                     Resources.HandlerPartNameTemplate,
                                                     configurationObject.Name));

            contentBuilder.AddEditTextPart(Resources.FaultContractExceptionHandlerExceptionMessagePartName,
                                           elementPolicyKeyName,
                                           ExceptionMessagePropertyName,
                                           configurationObject.ExceptionMessage,
                                           512,
                                           true);

            contentBuilder.AddEditTextPart(Resources.FaultContractExceptionHandlerFaultContractTypePartName,
                                           elementPolicyKeyName,
                                           FaultContractTypePropertyName,
                                           configurationObject.FaultContractType,
                                           512,
                                           true);

            contentBuilder.AddEditTextPart(Resources.FaultContractExceptionHandlerAttributesPartName,
                                           elementPolicyKeyName,
                                           AttributesPropertyName,
                                           GenerateAttributesString(configurationObject.Attributes),
                                           1024,
                                           false);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Adds the ADM parts that represent the properties of
        /// a specific instance of the configuration element type managed by the receiver.
        /// </summary>
        /// <param name="contentBuilder">The <see cref="AdmContentBuilder"/> to which the Adm instructions are to be appended.</param>
        /// <param name="configurationObject">The configuration object instance.</param>
        /// <param name="configurationSource">The configuration source from where to get additional configuration
        /// information, if necessary.</param>
        /// <param name="elementPolicyKeyName">The key for the element's policies.</param>
        /// <remarks>
        /// Subclasses managing objects that must not create a policy will likely need to include the elements' keys when creating the parts.
        /// </remarks>
        protected override void AddElementAdministrativeTemplateParts(AdmContentBuilder contentBuilder,
                                                                      FlatFileTraceListenerData configurationObject,
                                                                      IConfigurationSource configurationSource,
                                                                      String elementPolicyKeyName)
        {
            contentBuilder.AddEditTextPart(Resources.FlatFileTraceListenerFileNamePartName,
                                           FileNamePropertyName,
                                           configurationObject.FileName,
                                           255,
                                           true);

            contentBuilder.AddEditTextPart(Resources.FlatFileTraceListenerHeaderPartName,
                                           HeaderPropertyName,
                                           configurationObject.Header,
                                           512,
                                           false);

            contentBuilder.AddEditTextPart(Resources.FlatFileTraceListenerFooterPartName,
                                           FooterPropertyName,
                                           configurationObject.Footer,
                                           512,
                                           false);

            AddTraceOptionsPart(contentBuilder, elementPolicyKeyName, configurationObject.TraceOutputOptions);

            AddFilterPart(contentBuilder, configurationObject.Filter);

            AddFormattersPart(contentBuilder, configurationObject.Formatter, configurationSource);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Adds the ADM parts that represent the properties of
        /// a specific instance of the configuration element type managed by the receiver.
        /// </summary>
        /// <param name="contentBuilder">The <see cref="AdmContentBuilder"/> to which the Adm instructions are to be appended.</param>
        /// <param name="configurationObject">The configuration object instance.</param>
        /// <param name="configurationSource">The configuration source from where to get additional configuration
        /// information, if necessary.</param>
        /// <param name="elementPolicyKeyName">The key for the element's policies.</param>
        /// <remarks>
        /// Subclasses managing objects that must not create a policy will likely need to include the elements' keys when creating the parts.
        /// </remarks>
        protected override void AddElementAdministrativeTemplateParts(AdmContentBuilder contentBuilder,
                                                                      MsmqTraceListenerData configurationObject,
                                                                      IConfigurationSource configurationSource,
                                                                      String elementPolicyKeyName)
        {
            contentBuilder.AddEditTextPart(Resources.MsmqTraceListenerQueuePathPartName,
                                           QueuePathPropertyName,
                                           configurationObject.QueuePath,
                                           255,
                                           true);

            contentBuilder.AddDropDownListPartForEnumeration <MessagePriority>(Resources.MsmqTraceListenerPriorityPartName,
                                                                               MessagePriorityPropertyName,
                                                                               configurationObject.MessagePriority);

            contentBuilder.AddEditTextPart(Resources.MsmqTraceListenerTtbrPartName,
                                           TimeToBeReceivedPropertyName,
                                           Convert.ToString(configurationObject.TimeToBeReceived, CultureInfo.InvariantCulture),
                                           255,
                                           false);

            contentBuilder.AddEditTextPart(Resources.MsmqTraceListenerTtrqPartName,
                                           TimeToReachQueuePropertyName,
                                           Convert.ToString(configurationObject.TimeToReachQueue, CultureInfo.InvariantCulture),
                                           255,
                                           false);

            contentBuilder.AddCheckboxPart(Resources.MsmqTraceListenerRecoverablePartName,
                                           RecoverablePropertyName,
                                           configurationObject.Recoverable);

            contentBuilder.AddDropDownListPartForEnumeration <MessageQueueTransactionType>(Resources.MsmqTraceListenerTransactionTypePartName,
                                                                                           TransactionTypePropertyName,
                                                                                           configurationObject.TransactionType);

            contentBuilder.AddCheckboxPart(Resources.MsmqTraceListenerUseAuthenticationPartName,
                                           UseAuthenticationPropertyName,
                                           configurationObject.UseAuthentication);

            contentBuilder.AddCheckboxPart(Resources.MsmqTraceListenerUseDeadLetterQueuePartName,
                                           UseDeadLetterQueuePropertyName,
                                           configurationObject.UseDeadLetterQueue);

            contentBuilder.AddCheckboxPart(Resources.MsmqTraceListenerUseEncryptionPartName,
                                           UseEncryptionPropertyName,
                                           configurationObject.UseEncryption);

            AddTraceOptionsPart(contentBuilder, elementPolicyKeyName, configurationObject.TraceOutputOptions);

            AddFilterPart(contentBuilder, configurationObject.Filter);

            AddFormattersPart(contentBuilder, configurationObject.Formatter, configurationSource);
        }
        /// <summary>
        /// Adds the ADM parts that represent the properties of
        /// a specific instance of the configuration element type managed by the receiver.
        /// </summary>
        /// <param name="contentBuilder">The <see cref="AdmContentBuilder"/> to which the Adm instructions are to be appended.</param>
        /// <param name="configurationObject">The configuration object instance.</param>
        /// <param name="configurationSource">The configuration source from where to get additional configuration
        /// information, if necessary.</param>
        /// <param name="elementPolicyKeyName">The key for the element's policies.</param>
        /// <remarks>
        /// Subclasses managing objects that must not create a policy will likely need to include the elements' keys when creating the parts.
        /// </remarks>
        protected override void AddElementAdministrativeTemplateParts(AdmContentBuilder contentBuilder,
                                                                      RollingFlatFileTraceListenerData configurationObject,
                                                                      IConfigurationSource configurationSource,
                                                                      String elementPolicyKeyName)
        {
            contentBuilder.AddEditTextPart(Resources.RollingFlatFileTraceListenerFileNamePartName,
                                           FileNamePropertyName,
                                           configurationObject.FileName,
                                           255,
                                           true);

            contentBuilder.AddEditTextPart(Resources.FlatFileTraceListenerHeaderPartName,
                                           HeaderPropertyName,
                                           configurationObject.Header,
                                           512,
                                           false);

            contentBuilder.AddEditTextPart(Resources.FlatFileTraceListenerFooterPartName,
                                           FooterPropertyName,
                                           configurationObject.Footer,
                                           512,
                                           false);

            contentBuilder.AddDropDownListPartForEnumeration <RollFileExistsBehavior>(Resources.RollingFlatFileTraceListenerRollFileExistsBehaviorPartName,
                                                                                      RollFileExistsBehaviorPropertyName,
                                                                                      configurationObject.RollFileExistsBehavior);

            contentBuilder.AddDropDownListPartForEnumeration <RollInterval>(Resources.RollingFlatFileTraceListenerRollIntervalPartName,
                                                                            RollIntervalPropertyName,
                                                                            configurationObject.RollInterval);

            contentBuilder.AddNumericPart(Resources.RollingFlatFileTraceListenerRollSizeKBPartName,
                                          RollSizeKBPropertyName,
                                          configurationObject.RollSizeKB);

            contentBuilder.AddEditTextPart(Resources.RollingFlatFileTraceListenerTimeStampPatternPartName,
                                           TimeStampPatternPropertyName,
                                           configurationObject.TimeStampPattern,
                                           512,
                                           true);

            contentBuilder.AddNumericPart(Resources.RollingFlatFileTraceListenerMaxArchivedFilesPartName,
                                          MaxArchivedFilesPropertyName,
                                          configurationObject.MaxArchivedFiles);

            AddTraceOptionsPart(contentBuilder, elementPolicyKeyName, configurationObject.TraceOutputOptions);

            AddFilterPart(contentBuilder, configurationObject.Filter);

            AddFormattersPart(contentBuilder, configurationObject.Formatter, configurationSource);
        }
        /// <summary>
        /// Adds the ADM instructions that describe the policies that can be used to override the configuration
        /// information represented by a configuration section.
        /// </summary>
        /// <param name="contentBuilder">The <see cref="AdmContentBuilder"/> to which the Adm instructions are to be appended.</param>
        /// <param name="configurationSection">The configuration section instance.</param>
        /// <param name="configurationSource">The configuration source from where to get additional configuration
        /// information, if necessary.</param>
        /// <param name="sectionKey">The root key for the section's policies.</param>
        protected override void AddAdministrativeTemplateDirectives(AdmContentBuilder contentBuilder,
                                                                    ConnectionStringsSection configurationSection,
                                                                    IConfigurationSource configurationSource,
                                                                    String sectionKey)
        {
            contentBuilder.StartCategory(Resources.ConnectionStringsCategoryName);
            {
                foreach (ConnectionStringSettings connectionString in configurationSection.ConnectionStrings)
                {
                    contentBuilder.StartPolicy(String.Format(CultureInfo.InvariantCulture,
                                                             Resources.ConnectionStringPolicyNameTemplate,
                                                             connectionString.Name),
                                               sectionKey + @"\" + connectionString.Name);

                    contentBuilder.AddEditTextPart(Resources.ConnectionStringConnectionStringPartName,
                                                   ConnectionStringPropertyName,
                                                   connectionString.ConnectionString,
                                                   500,
                                                   true);

                    contentBuilder.AddComboBoxPart(Resources.ConnectionStringProviderNamePartName,
                                                   ProviderNamePropertyName,
                                                   connectionString.ProviderName,
                                                   255,
                                                   true,
                                                   "System.Data.SqlClient",
                                                   "System.Data.OracleClient");

                    contentBuilder.EndPolicy();
                }
            }
            contentBuilder.EndCategory();
        }
Ejemplo n.º 9
0
 protected override void AddElementAdministrativeTemplateParts(AdmContentBuilder contentBuilder,
                                                               T configurationObject,
                                                               IConfigurationSource configurationSource,
                                                               String elementPolicyKeyName)
 {
     contentBuilder.AddEditTextPart(Resources.CustomProviderTypePartName,
                                    ProviderTypePropertyName,
                                    configurationObject.Type.AssemblyQualifiedName,
                                    1024,
                                    true);
     contentBuilder.AddEditTextPart(Resources.CustomProviderAttributesPartName,
                                    AttributesPropertyName,
                                    GenerateAttributesString(configurationObject.Attributes),
                                    1024,
                                    false);
 }
        /// <summary>
        /// Adds the ADM parts that represent the properties of
        /// a specific instance of the configuration element type managed by the receiver.
        /// </summary>
        /// <param name="contentBuilder">The <see cref="AdmContentBuilder"/> to which the Adm instructions are to be appended.</param>
        /// <param name="configurationObject">The configuration object instance.</param>
        /// <param name="configurationSource">The configuration source from where to get additional configuration
        /// information, if necessary.</param>
        /// <param name="elementPolicyKeyName">The key for the element's policies.</param>
        /// <remarks>
        /// Subclasses that manage custom provider's configuration objects with additional properties may
        /// override this method to add the corresponding parts.
        /// </remarks>
        /// <seealso cref="ConfigurationElementManageabilityProviderBase{T}.AddAdministrativeTemplateDirectives(AdmContentBuilder, T, IConfigurationSource, String)"/>
        protected override void AddElementAdministrativeTemplateParts(
            AdmContentBuilder contentBuilder,
            T configurationObject,
            IConfigurationSource configurationSource,
            string elementPolicyKeyName)
        {
            base.AddElementAdministrativeTemplateParts(contentBuilder,
                                                       configurationObject,
                                                       configurationSource,
                                                       elementPolicyKeyName);

            contentBuilder.AddEditTextPart(Resources.CustomTraceListenerInitializationPartName,
                                           InitDataPropertyName,
                                           configurationObject.InitData,
                                           1024,
                                           false);

            contentBuilder.AddTextPart(Resources.TraceListenerTraceOptionsPartName);

            var traceOptionsKey = elementPolicyKeyName + @"\" + TraceOutputOptionsPropertyName;

            AddCheckboxPartsForFlagsEnumeration <TraceOptions>(contentBuilder, traceOptionsKey, configurationObject.TraceOutputOptions);

            contentBuilder.AddDropDownListPartForEnumeration <SourceLevels>(Resources.TraceListenerFilterPartName,
                                                                            FilterPropertyName,
                                                                            configurationObject.Filter);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Adds the ADM instructions that describe the policies that can be used to override the configuration
        /// information represented by a configuration section.
        /// </summary>
        /// <param name="contentBuilder">The <see cref="AdmContentBuilder"/> to which the Adm instructions are to be appended.</param>
        /// <param name="configurationSection">The configuration section instance.</param>
        /// <param name="configurationSource">The configuration source from where to get additional configuration
        /// information, if necessary.</param>
        /// <param name="sectionKey">The root key for the section's policies.</param>
        protected override void AddAdministrativeTemplateDirectives(AdmContentBuilder contentBuilder,
                                                                    OracleConnectionSettings configurationSection,
                                                                    IConfigurationSource configurationSource,
                                                                    String sectionKey)
        {
            contentBuilder.StartCategory(Resources.OracleConnectionsCategoryName);
            {
                foreach (OracleConnectionData data in configurationSection.OracleConnectionsData)
                {
                    String connectionPolicyKey = sectionKey + @"\" + data.Name;

                    contentBuilder.StartPolicy(String.Format(CultureInfo.InvariantCulture,
                                                             Resources.OracleConnectionPolicyNameTemplate,
                                                             data.Name),
                                               connectionPolicyKey);
                    {
                        contentBuilder.AddEditTextPart(Resources.OracleConnectionPackagesPartName,
                                                       PackagesPropertyName,
                                                       GenerateRulesString(data.Packages),
                                                       1024,
                                                       true);
                    }
                    contentBuilder.EndPolicy();
                }
            }
            contentBuilder.EndCategory();
        }
        /// <summary>
        /// Adds the ADM parts that represent the properties of
        /// a specific instance of the configuration element type managed by the receiver.
        /// </summary>
        /// <param name="contentBuilder">The <see cref="AdmContentBuilder"/> to which the Adm instructions are to be appended.</param>
        /// <param name="configurationObject">The configuration object instance.</param>
        /// <param name="configurationSource">The configuration source from where to get additional configuration
        /// information, if necessary.</param>
        /// <param name="elementPolicyKeyName">The key for the element's policies.</param>
        /// <remarks>
        /// Subclasses managing objects that must not create a policy will likely need to include the elements' keys when creating the parts.
        /// </remarks>
        protected override void AddElementAdministrativeTemplateParts(AdmContentBuilder contentBuilder,
                                                                      DataCacheStorageData configurationObject,
                                                                      IConfigurationSource configurationSource,
                                                                      String elementPolicyKeyName)
        {
            List <AdmDropDownListItem> connectionStrings = new List <AdmDropDownListItem>();
            ConnectionStringsSection   connectionStringsSection
                = (ConnectionStringsSection)configurationSource.GetSection("connectionStrings");

            if (connectionStringsSection != null)
            {
                foreach (ConnectionStringSettings connectionString in connectionStringsSection.ConnectionStrings)
                {
                    connectionStrings.Add(new AdmDropDownListItem(connectionString.Name, connectionString.Name));
                }
            }
            contentBuilder.AddDropDownListPart(Resources.DataCacheStorageDatabaseInstanceNamePartName,
                                               elementPolicyKeyName,
                                               DatabaseInstanceNamePropertyName,
                                               connectionStrings,
                                               configurationObject.DatabaseInstanceName);

            contentBuilder.AddEditTextPart(Resources.DataCacheStoragePartitionNamePartName,
                                           elementPolicyKeyName,
                                           PartitionNamePropertyName,
                                           configurationObject.PartitionName,
                                           255,
                                           true);
        }
        /// <summary>
        /// Adds the ADM parts that represent the properties of
        /// a specific instance of the configuration element type managed by the receiver.
        /// </summary>
        /// <param name="contentBuilder">The <see cref="AdmContentBuilder"/> to which the Adm instructions are to be appended.</param>
        /// <param name="configurationObject">The configuration object instance.</param>
        /// <param name="configurationSource">The configuration source from where to get additional configuration
        /// information, if necessary.</param>
        /// <param name="elementPolicyKeyName">The key for the element's policies.</param>
        /// <remarks>
        /// Subclasses managing objects that must not create a policy will likely need to include the elements' keys when creating the parts.
        /// </remarks>
        protected override void AddElementAdministrativeTemplateParts(AdmContentBuilder contentBuilder,
                                                                      EmailTraceListenerData configurationObject,
                                                                      IConfigurationSource configurationSource,
                                                                      String elementPolicyKeyName)
        {
            contentBuilder.AddEditTextPart(Resources.EmailTraceListenerFromAddressPartName,
                                           FromAddressPropertyName,
                                           configurationObject.FromAddress,
                                           255,
                                           true);

            contentBuilder.AddEditTextPart(Resources.EmailTraceListenerToAddressPartName,
                                           ToAddressPropertyName,
                                           configurationObject.ToAddress,
                                           255,
                                           false);

            contentBuilder.AddNumericPart(Resources.EmailTraceListenerSmtpPortPartName,
                                          SmtpPortPropertyName,
                                          configurationObject.SmtpPort);

            contentBuilder.AddEditTextPart(Resources.EmailTraceListenerSmtpServerPartName,
                                           SmtpServerPropertyName,
                                           configurationObject.SmtpServer,
                                           255,
                                           true);

            contentBuilder.AddEditTextPart(Resources.EmailTraceListenerStarterPartName,
                                           SubjectLineStarterPropertyName,
                                           configurationObject.SubjectLineStarter,
                                           255,
                                           false);

            contentBuilder.AddEditTextPart(Resources.EmailTraceListenerEnderPartName,
                                           SubjectLineEnderPropertyName,
                                           configurationObject.SubjectLineEnder,
                                           255,
                                           false);

            AddTraceOptionsPart(contentBuilder, elementPolicyKeyName, configurationObject.TraceOutputOptions);

            AddFilterPart(contentBuilder, configurationObject.Filter);

            AddFormattersPart(contentBuilder, configurationObject.Formatter, configurationSource);
        }
Ejemplo n.º 14
0
 protected override void AddElementAdministrativeTemplateParts(AdmContentBuilder contentBuilder,
                                                               AuthorizationRuleProviderData configurationObject,
                                                               IConfigurationSource configurationSource,
                                                               String elementPolicyKeyName)
 {
     contentBuilder.AddEditTextPart(Resources.AuthorizationRuleProviderRulesPartName,
                                    RulesPropertyName,
                                    GenerateRulesString(configurationObject.Rules),
                                    1024,
                                    true);
 }
 protected override void AddElementAdministrativeTemplateParts(AdmContentBuilder contentBuilder,
                                                               ReplaceHandlerData configurationObject,
                                                               IConfigurationSource configurationSource,
                                                               String elementPolicyKeyName)
 {
     contentBuilder.AddTextPart(String.Format(CultureInfo.CurrentCulture,
                                              Resources.HandlerPartNameTemplate,
                                              configurationObject.Name));
     contentBuilder.AddEditTextPart(Resources.ReplaceHandlerExceptionMessagePartName,
                                    elementPolicyKeyName,
                                    ExceptionMessagePropertyName,
                                    configurationObject.ExceptionMessage,
                                    1024,
                                    true);
     contentBuilder.AddEditTextPart(Resources.ReplaceHandlerExceptionTypePartName,
                                    elementPolicyKeyName,
                                    ReplaceExceptionTypePropertyName,
                                    configurationObject.ReplaceExceptionType.AssemblyQualifiedName,
                                    1024,
                                    true);
 }
 protected override void AddElementAdministrativeTemplateParts(AdmContentBuilder contentBuilder,
                                                               IsolatedStorageCacheStorageData configurationObject,
                                                               IConfigurationSource configurationSource,
                                                               String elementPolicyKeyName)
 {
     contentBuilder.AddEditTextPart(Resources.IsolatedStorageCacheStorageDataPartitionNamePartName,
                                    elementPolicyKeyName,
                                    PartitionNamePropertyName,
                                    configurationObject.PartitionName,
                                    255,
                                    true);
 }
 protected override void AddElementAdministrativeTemplateParts(AdmContentBuilder contentBuilder,
                                                               CustomHandlerData configurationObject,
                                                               IConfigurationSource configurationSource,
                                                               String elementPolicyKeyName)
 {
     contentBuilder.AddTextPart(String.Format(CultureInfo.CurrentCulture,
                                              Resources.HandlerPartNameTemplate,
                                              configurationObject.Name));
     contentBuilder.AddEditTextPart(Resources.CustomHandlerTypePartName,
                                    elementPolicyKeyName,
                                    ProviderTypePropertyName,
                                    configurationObject.Type.AssemblyQualifiedName,
                                    1024,
                                    true);
     contentBuilder.AddEditTextPart(Resources.CustomHandlerAttributesPartName,
                                    elementPolicyKeyName,
                                    AttributesPropertyName,
                                    GenerateAttributesString(configurationObject.Attributes),
                                    1024,
                                    false);
 }
Ejemplo n.º 18
0
        protected override void AddElementAdministrativeTemplateParts(AdmContentBuilder contentBuilder,
                                                                      XmlTraceListenerData configurationObject,
                                                                      IConfigurationSource configurationSource,
                                                                      String elementPolicyKeyName)
        {
            contentBuilder.AddEditTextPart(Resources.XmlTraceListenerFileNamePartName,
                                           FileNamePropertyName,
                                           configurationObject.FileName,
                                           255,
                                           true);

            AddTraceOptionsPart(contentBuilder, configurationObject.TraceOutputOptions);
        }
Ejemplo n.º 19
0
 protected override void AddElementAdministrativeTemplateParts(AdmContentBuilder contentBuilder,
                                                               TextFormatterData configurationObject,
                                                               IConfigurationSource configurationSource,
                                                               String elementPolicyKeyName)
 {
     contentBuilder.AddEditTextPart(Resources.TextFormatterTemplatePartName,
                                    TemplatePropertyName,
                                    "",
                                    1024,
                                    true);
     contentBuilder.AddTextPart(Resources.TextFormatterEscapeInstructions_1);
     contentBuilder.AddTextPart(Resources.TextFormatterEscapeInstructions_2);
 }
        /// <summary>
        /// Adds the ADM parts that represent the properties of
        /// a specific instance of the configuration element type managed by the receiver.
        /// </summary>
        /// <param name="contentBuilder">The <see cref="AdmContentBuilder"/> to which the Adm instructions are to be appended.</param>
        /// <param name="configurationObject">The configuration object instance.</param>
        /// <param name="configurationSource">The configuration source from where to get additional configuration
        /// information, if necessary.</param>
        /// <param name="elementPolicyKeyName">The key for the element's policies.</param>
        /// <remarks>
        /// Subclasses managing objects that must not create a policy will likely need to include the elements' keys when creating the parts.
        /// </remarks>
        protected override void AddElementAdministrativeTemplateParts(AdmContentBuilder contentBuilder,
                                                                      LoggingExceptionHandlerData configurationObject,
                                                                      IConfigurationSource configurationSource,
                                                                      String elementPolicyKeyName)
        {
            contentBuilder.AddTextPart(String.Format(CultureInfo.CurrentCulture,
                                                     Resources.HandlerPartNameTemplate,
                                                     configurationObject.Name));

            contentBuilder.AddEditTextPart(Resources.LoggingHandlerTitlePartName,
                                           elementPolicyKeyName,
                                           TitlePropertyName,
                                           configurationObject.Title,
                                           255,
                                           true);

            contentBuilder.AddNumericPart(Resources.LoggingHandlerEventIdPartName,
                                          elementPolicyKeyName,
                                          EventIdPropertyName,
                                          configurationObject.EventId);

            contentBuilder.AddDropDownListPartForEnumeration <TraceEventType>(Resources.LoggingHandlerSeverityPartName,
                                                                              elementPolicyKeyName,
                                                                              SeverityPropertyName,
                                                                              configurationObject.Severity);

            contentBuilder.AddNumericPart(Resources.LoggingHandlerPriorityPartName,
                                          elementPolicyKeyName,
                                          PriorityPropertyName,
                                          configurationObject.Priority);

            LoggingSettings loggingConfigurationSection
                = configurationSource.GetSection(LoggingSettings.SectionName) as LoggingSettings;

            contentBuilder.AddDropDownListPartForNamedElementCollection <TraceSourceData>(Resources.LoggingHandlerCategoryPartName,
                                                                                          elementPolicyKeyName,
                                                                                          LogCategoryPropertyName,
                                                                                          loggingConfigurationSection.TraceSources,
                                                                                          configurationObject.LogCategory,
                                                                                          false);

            contentBuilder.AddComboBoxPart(Resources.LoggingHandlerFormatterPartName,
                                           elementPolicyKeyName,
                                           FormatterTypePropertyName,
                                           configurationObject.FormatterType.AssemblyQualifiedName,
                                           255,
                                           true,
                                           typeof(TextExceptionFormatter).AssemblyQualifiedName,
                                           typeof(XmlExceptionFormatter).AssemblyQualifiedName);
        }
Ejemplo n.º 21
0
        protected override void AddElementAdministrativeTemplateParts(AdmContentBuilder contentBuilder,
                                                                      SymmetricAlgorithmProviderData configurationObject,
                                                                      IConfigurationSource configurationSource,
                                                                      String elementPolicyKeyName)
        {
            contentBuilder.AddEditTextPart(Resources.SymmetricAlgorithmProviderKeyFileNamePartName,
                                           ProtectedKeyFilenamePropertyName,
                                           configurationObject.ProtectedKeyFilename,
                                           255,
                                           true);

            contentBuilder.AddDropDownListPartForEnumeration <DataProtectionScope>(Resources.SymmetricAlgorithmProviderKeyProtectionScopePartName,
                                                                                   ProtectedKeyProtectionScopePropertyName,
                                                                                   configurationObject.ProtectedKeyProtectionScope);
        }
Ejemplo n.º 22
0
 protected override void AddAdministrativeTemplateDirectives(
     AdmContentBuilder contentBuilder,
     OracleConnectionSettings configurationSection,
     IConfigurationSource configurationSource,
     string sectionKey)
 {
     contentBuilder.StartCategory(Resources.OracleConnectionsCategoryName);
     foreach (OracleConnectionData oracleConnectionData in configurationSection.OracleConnectionsData)
     {
         string policyKey = sectionKey + "\\" + oracleConnectionData.Name;
         contentBuilder.StartPolicy(string.Format((IFormatProvider)CultureInfo.InvariantCulture, Resources.OracleConnectionPolicyNameTemplate, (object)oracleConnectionData.Name), policyKey);
         contentBuilder.AddEditTextPart(Resources.OracleConnectionPackagesPartName, "packages", OracleConnectionSettingsManageabilityProvider.GenerateRulesString((IEnumerable <OraclePackageData>)oracleConnectionData.Packages), 1024, true);
         contentBuilder.EndPolicy();
     }
     contentBuilder.EndCategory();
 }
 protected override void AddAdministrativeTemplateDirectives(
     AdmContentBuilder contentBuilder,
     ConnectionStringsSection configurationSection,
     IConfigurationSource configurationSource,
     string sectionKey)
 {
     contentBuilder.StartCategory(Resources.ConnectionStringsCategoryName);
     foreach (ConnectionStringSettings connectionString in (ConfigurationElementCollection)configurationSection.ConnectionStrings)
     {
         contentBuilder.StartPolicy(string.Format((IFormatProvider)CultureInfo.InvariantCulture, Resources.ConnectionStringPolicyNameTemplate, (object)connectionString.Name), sectionKey + "\\" + connectionString.Name);
         contentBuilder.AddEditTextPart(Resources.ConnectionStringConnectionStringPartName, "connectionString", connectionString.ConnectionString, 500, true);
         contentBuilder.AddComboBoxPart(Resources.ConnectionStringProviderNamePartName, "providerName", connectionString.ProviderName, (int)byte.MaxValue, true, "System.Data.SqlClient", "System.Data.OracleClient");
         contentBuilder.EndPolicy();
     }
     contentBuilder.EndCategory();
 }
Ejemplo n.º 24
0
        protected override void AddElementAdministrativeTemplateParts(AdmContentBuilder contentBuilder, T configurationObject, IConfigurationSource configurationSource, string elementPolicyKeyName)
        {
            base.AddElementAdministrativeTemplateParts(contentBuilder,
                                                       configurationObject,
                                                       configurationSource,
                                                       elementPolicyKeyName);

            contentBuilder.AddEditTextPart(Resources.CustomTraceListenerInitializationPartName,
                                           InitDataPropertyName,
                                           configurationObject.InitData,
                                           1024,
                                           false);

            contentBuilder.AddDropDownListPartForEnumeration <TraceOptions>(Resources.TraceListenerTraceOptionsPartName,
                                                                            TraceOutputOptionsPropertyName,
                                                                            configurationObject.TraceOutputOptions);
        }
        public void CanAddEditTextPartWithKeyName()
        {
            AdmContentBuilder builder = new AdmContentBuilder();

            builder.StartCategory("category");
            builder.StartPolicy("policy", "key");
            builder.AddEditTextPart("part", "key", "value", "default", 10, true);
            builder.EndPolicy();
            builder.EndCategory();
            AdmContent content = builder.GetContent();

            IEnumerator<AdmCategory> categoriesEnumerator = content.Categories.GetEnumerator();
            categoriesEnumerator.MoveNext();
            IEnumerator<AdmPolicy> policiesEnumerator = categoriesEnumerator.Current.Policies.GetEnumerator();
            policiesEnumerator.MoveNext();
            IEnumerator<AdmPart> partsEnumerator = policiesEnumerator.Current.Parts.GetEnumerator();
            Assert.IsTrue(partsEnumerator.MoveNext());
            Assert.AreSame(typeof(AdmEditTextPart), partsEnumerator.Current.GetType());
            Assert.AreEqual("part", ((AdmEditTextPart)partsEnumerator.Current).PartName);
            Assert.AreEqual("key", ((AdmEditTextPart)partsEnumerator.Current).KeyName);
            Assert.AreEqual("value", ((AdmEditTextPart)partsEnumerator.Current).ValueName);
            Assert.AreEqual("default", ((AdmEditTextPart)partsEnumerator.Current).DefaultValue);
            Assert.AreEqual(10, ((AdmEditTextPart)partsEnumerator.Current).Maxlen);
            Assert.AreEqual(true, ((AdmEditTextPart)partsEnumerator.Current).Required);
        }
        public void AddEditTextWithDefaultValueLongerThanMaxLengthThrows()
        {
            AdmContentBuilder builder = new AdmContentBuilder();

            builder.StartCategory("category");
            builder.StartPolicy("policy", "key");
            builder.AddEditTextPart("part", "key", "value", "123456789012345678901", 20, true);
        }
        public void AddEditTextWithInvalidMaxLengthThrows()
        {
            AdmContentBuilder builder = new AdmContentBuilder();

            builder.StartCategory("category");
            builder.StartPolicy("policy", "key");
            builder.AddEditTextPart("part", "key", "value", "default", 1100, true);
        }