Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / Configuration / System / Configuration / ConnectionStringSettings.cs / 1 / ConnectionStringSettings.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Configuration { using System; using System.Xml; using System.Configuration; using System.Collections.Specialized; using System.Collections; using System.IO; using System.Text; public sealed class ConnectionStringSettings : ConfigurationElement { private static ConfigurationPropertyCollection _properties; private static readonly ConfigurationProperty _propName = new ConfigurationProperty( "name", typeof(string), null, null, ConfigurationProperty.NonEmptyStringValidator, ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey); private static readonly ConfigurationProperty _propConnectionString = new ConfigurationProperty("connectionString", typeof(string), "", ConfigurationPropertyOptions.IsRequired); private static readonly ConfigurationProperty _propProviderName = new ConfigurationProperty("providerName", typeof(string), String.Empty, ConfigurationPropertyOptions.None); static ConnectionStringSettings() { // Property initialization _properties = new ConfigurationPropertyCollection(); _properties.Add(_propName); _properties.Add(_propConnectionString); _properties.Add(_propProviderName); } public ConnectionStringSettings() { } public ConnectionStringSettings(String name, String connectionString) : this() { Name = name; ConnectionString = connectionString; // ProviderName = (string) _propProviderName.DefaultValue; } public ConnectionStringSettings(String name, String connectionString, String providerName) : this() { Name = name; ConnectionString = connectionString; ProviderName = providerName; } internal string Key { get { return Name; } } protected internal override ConfigurationPropertyCollection Properties { get { return _properties; } } [ConfigurationProperty("name", Options = ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey, DefaultValue = "")] public string Name { get { return (string)base[_propName]; } set { base[_propName] = value; } } [ConfigurationProperty("connectionString", Options = ConfigurationPropertyOptions.IsRequired, DefaultValue = "")] public string ConnectionString { get { return (string)base[_propConnectionString]; } set { base[_propConnectionString] = value; } } public override string ToString() { return ConnectionString; } [ConfigurationProperty("providerName", DefaultValue = "System.Data.SqlClient")] public string ProviderName { get { return (string)base[_propProviderName]; } set { base[_propProviderName] = value; } } } // class ConnectionStringSettings } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Configuration { using System; using System.Xml; using System.Configuration; using System.Collections.Specialized; using System.Collections; using System.IO; using System.Text; public sealed class ConnectionStringSettings : ConfigurationElement { private static ConfigurationPropertyCollection _properties; private static readonly ConfigurationProperty _propName = new ConfigurationProperty( "name", typeof(string), null, null, ConfigurationProperty.NonEmptyStringValidator, ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey); private static readonly ConfigurationProperty _propConnectionString = new ConfigurationProperty("connectionString", typeof(string), "", ConfigurationPropertyOptions.IsRequired); private static readonly ConfigurationProperty _propProviderName = new ConfigurationProperty("providerName", typeof(string), String.Empty, ConfigurationPropertyOptions.None); static ConnectionStringSettings() { // Property initialization _properties = new ConfigurationPropertyCollection(); _properties.Add(_propName); _properties.Add(_propConnectionString); _properties.Add(_propProviderName); } public ConnectionStringSettings() { } public ConnectionStringSettings(String name, String connectionString) : this() { Name = name; ConnectionString = connectionString; // ProviderName = (string) _propProviderName.DefaultValue; } public ConnectionStringSettings(String name, String connectionString, String providerName) : this() { Name = name; ConnectionString = connectionString; ProviderName = providerName; } internal string Key { get { return Name; } } protected internal override ConfigurationPropertyCollection Properties { get { return _properties; } } [ConfigurationProperty("name", Options = ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey, DefaultValue = "")] public string Name { get { return (string)base[_propName]; } set { base[_propName] = value; } } [ConfigurationProperty("connectionString", Options = ConfigurationPropertyOptions.IsRequired, DefaultValue = "")] public string ConnectionString { get { return (string)base[_propConnectionString]; } set { base[_propConnectionString] = value; } } public override string ToString() { return ConnectionString; } [ConfigurationProperty("providerName", DefaultValue = "System.Data.SqlClient")] public string ProviderName { get { return (string)base[_propProviderName]; } set { base[_propProviderName] = value; } } } // class ConnectionStringSettings } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SmtpMail.cs
- InternalTypeHelper.cs
- CollectionDataContractAttribute.cs
- XmlSerializationReader.cs
- TableAdapterManagerGenerator.cs
- XmlDocumentType.cs
- PropertyConverter.cs
- RuntimeCompatibilityAttribute.cs
- SafeTimerHandle.cs
- Icon.cs
- InfoCardBaseException.cs
- DrawItemEvent.cs
- WebPartTransformer.cs
- WebResponse.cs
- DrawListViewColumnHeaderEventArgs.cs
- HtmlWindowCollection.cs
- NameValueCollection.cs
- BasicAsyncResult.cs
- QualifiedCellIdBoolean.cs
- OdbcConnectionFactory.cs
- ToolStripLabel.cs
- PreProcessInputEventArgs.cs
- TableParaClient.cs
- TextBoxAutomationPeer.cs
- StaticResourceExtension.cs
- HwndHost.cs
- Int64Converter.cs
- RuleSettingsCollection.cs
- D3DImage.cs
- HierarchicalDataSourceDesigner.cs
- _CookieModule.cs
- FontStyleConverter.cs
- EnumConverter.cs
- ProviderConnectionPoint.cs
- StylusCaptureWithinProperty.cs
- RowSpanVector.cs
- BitmapEffect.cs
- X509InitiatorCertificateClientElement.cs
- CodeArrayCreateExpression.cs
- Int64Storage.cs
- TraceContextEventArgs.cs
- metrodevice.cs
- Activity.cs
- HandleCollector.cs
- ServiceNameElement.cs
- infer.cs
- AuditLevel.cs
- CommonRemoteMemoryBlock.cs
- WmlMobileTextWriter.cs
- Pts.cs
- ExpressionBindingCollection.cs
- ScrollPatternIdentifiers.cs
- StringAnimationBase.cs
- SendMessageContent.cs
- HtmlTitle.cs
- assertwrapper.cs
- CacheVirtualItemsEvent.cs
- ExtensionWindow.cs
- DataGridItemEventArgs.cs
- AdapterSwitches.cs
- TextRunProperties.cs
- SqlPersonalizationProvider.cs
- AttachedPropertyMethodSelector.cs
- HwndAppCommandInputProvider.cs
- NativeRecognizer.cs
- SynchronizedDispatch.cs
- FaultDescriptionCollection.cs
- StaticContext.cs
- DirectoryGroupQuery.cs
- SoapIgnoreAttribute.cs
- ManualResetEventSlim.cs
- CharacterBuffer.cs
- RadioButton.cs
- FrameworkPropertyMetadata.cs
- WebRequestModulesSection.cs
- Camera.cs
- DataObjectEventArgs.cs
- Parallel.cs
- ComponentConverter.cs
- ListViewSortEventArgs.cs
- HighContrastHelper.cs
- ProbeRequestResponseAsyncResult.cs
- WindowsSecurityToken.cs
- ConsoleEntryPoint.cs
- DBConnectionString.cs
- ApplicationFileCodeDomTreeGenerator.cs
- Listbox.cs
- CodeSubDirectory.cs
- DispatcherSynchronizationContext.cs
- SqlFunctionAttribute.cs
- HijriCalendar.cs
- PrimitiveRenderer.cs
- ProxyManager.cs
- _TransmitFileOverlappedAsyncResult.cs
- ComNativeDescriptor.cs
- FormViewRow.cs
- DataKeyCollection.cs
- ZipIOLocalFileDataDescriptor.cs
- SecureUICommand.cs
- GlobalProxySelection.cs