Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Configuration / System / Configuration / ConnectionStringSettings.cs / 1305376 / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ISAPIRuntime.cs
- CheckBoxRenderer.cs
- MultiDataTrigger.cs
- DataGridCommandEventArgs.cs
- DescendantQuery.cs
- TemplateBamlRecordReader.cs
- DirectoryObjectSecurity.cs
- Win32SafeHandles.cs
- WindowInteropHelper.cs
- MenuItemAutomationPeer.cs
- DataGridViewComboBoxColumn.cs
- SqlDataSourceStatusEventArgs.cs
- PathFigure.cs
- TreeView.cs
- Control.cs
- SmiConnection.cs
- MdiWindowListStrip.cs
- WebPartUtil.cs
- DispatcherObject.cs
- httpstaticobjectscollection.cs
- LinqDataSource.cs
- StickyNote.cs
- SqlException.cs
- Int32EqualityComparer.cs
- HelloOperationCD1AsyncResult.cs
- PerformanceCounterPermissionEntry.cs
- NavigationService.cs
- SecurityContextCookieSerializer.cs
- VectorCollectionConverter.cs
- AmbientValueAttribute.cs
- RestClientProxyHandler.cs
- HyperLinkColumn.cs
- XmlExceptionHelper.cs
- ArgumentOutOfRangeException.cs
- FilteredAttributeCollection.cs
- HMACSHA1.cs
- C14NUtil.cs
- ConnectorDragDropGlyph.cs
- XmlNodeComparer.cs
- CacheMemory.cs
- SchemaImporterExtension.cs
- MemberMaps.cs
- LostFocusEventManager.cs
- MarshalByValueComponent.cs
- DeploymentExceptionMapper.cs
- PropertyIDSet.cs
- DesignOnlyAttribute.cs
- CheckableControlBaseAdapter.cs
- ResourcePermissionBase.cs
- DataGridViewCellParsingEventArgs.cs
- BasicSecurityProfileVersion.cs
- AsymmetricSignatureDeformatter.cs
- EditorOptionAttribute.cs
- SafeTimerHandle.cs
- XsltFunctions.cs
- Types.cs
- Tablet.cs
- ReceiveMessageContent.cs
- MenuItemCollection.cs
- GuidelineSet.cs
- ToolBarPanel.cs
- RegistryHandle.cs
- StackOverflowException.cs
- CodeExporter.cs
- EpmCustomContentWriterNodeData.cs
- ToolStripItemCollection.cs
- ProxySimple.cs
- RequestResponse.cs
- GetRecipientListRequest.cs
- TileBrush.cs
- TransportDefaults.cs
- KeyValueConfigurationCollection.cs
- CqlBlock.cs
- X509ClientCertificateAuthenticationElement.cs
- Int32Collection.cs
- DataBindingCollection.cs
- ColorAnimation.cs
- LogManagementAsyncResult.cs
- TickBar.cs
- diagnosticsswitches.cs
- ComPlusServiceLoader.cs
- BooleanStorage.cs
- ReadOnlyAttribute.cs
- HostingPreferredMapPath.cs
- documentsequencetextpointer.cs
- ResourceDefaultValueAttribute.cs
- NativeBuffer.cs
- Permission.cs
- ObjectTokenCategory.cs
- OletxEnlistment.cs
- NullEntityWrapper.cs
- XmlSchemaAppInfo.cs
- SerialPort.cs
- SingleStorage.cs
- SqlClientMetaDataCollectionNames.cs
- DataViewListener.cs
- cookiecollection.cs
- PropertyMapper.cs
- SoapMessage.cs
- FieldAccessException.cs