Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- CatalogZone.cs
- DrawingServices.cs
- WindowsPrincipal.cs
- XmlDomTextWriter.cs
- DeviceFilterDictionary.cs
- Matrix.cs
- VisualStates.cs
- TdsParserSafeHandles.cs
- CategoriesDocumentFormatter.cs
- ThreadStateException.cs
- NetNamedPipeSecurity.cs
- EnumType.cs
- Debug.cs
- DataGridViewRowsRemovedEventArgs.cs
- RegisteredScript.cs
- Trace.cs
- Memoizer.cs
- ClearCollection.cs
- BaseDataList.cs
- DataServiceProviderWrapper.cs
- WebControlAdapter.cs
- FontInfo.cs
- messageonlyhwndwrapper.cs
- CapabilitiesAssignment.cs
- EventLogPermissionEntryCollection.cs
- EntityContainerAssociationSetEnd.cs
- StringAnimationUsingKeyFrames.cs
- ElapsedEventArgs.cs
- LiteralLink.cs
- OutputCacheProfile.cs
- AsyncPostBackTrigger.cs
- BaseComponentEditor.cs
- BitmapFrameDecode.cs
- MatrixKeyFrameCollection.cs
- WebPartTransformerCollection.cs
- QilGenerator.cs
- AttachedPropertyMethodSelector.cs
- QueryableFilterUserControl.cs
- StringArrayConverter.cs
- RequestUriProcessor.cs
- TextElementCollectionHelper.cs
- AutomationIdentifier.cs
- ExpressionsCollectionEditor.cs
- ConnectionManagementElementCollection.cs
- PasswordPropertyTextAttribute.cs
- XmlSchemaSimpleTypeRestriction.cs
- ConfigurationStrings.cs
- ToolStripContentPanel.cs
- XPathNodeIterator.cs
- XmlWriterTraceListener.cs
- IISUnsafeMethods.cs
- DotAtomReader.cs
- ObjectQuery.cs
- HtmlElementErrorEventArgs.cs
- IdleTimeoutMonitor.cs
- EntityConnection.cs
- OverrideMode.cs
- HierarchicalDataSourceControl.cs
- ExtensionFile.cs
- Symbol.cs
- DataSourceXmlSerializer.cs
- JsonFormatGeneratorStatics.cs
- _UncName.cs
- FloatAverageAggregationOperator.cs
- TypographyProperties.cs
- PropertyChangingEventArgs.cs
- HttpResponseHeader.cs
- MDIWindowDialog.cs
- MethodBuilder.cs
- wpf-etw.cs
- OracleConnection.cs
- DrawingAttributesDefaultValueFactory.cs
- ExceptionRoutedEventArgs.cs
- UnsafeNativeMethodsTablet.cs
- AttributeQuery.cs
- OperationAbortedException.cs
- _emptywebproxy.cs
- BitmapSourceSafeMILHandle.cs
- Compiler.cs
- Vector.cs
- SqlConnectionPoolProviderInfo.cs
- ColorConvertedBitmapExtension.cs
- HttpModuleCollection.cs
- WizardSideBarListControlItem.cs
- _ConnectionGroup.cs
- KeyManager.cs
- TrackBarRenderer.cs
- RuleSetBrowserDialog.cs
- MultipleViewPattern.cs
- EpmContentSerializerBase.cs
- ProcessHostServerConfig.cs
- FocusChangedEventArgs.cs
- RayMeshGeometry3DHitTestResult.cs
- CallTemplateAction.cs
- ObfuscateAssemblyAttribute.cs
- BufferModesCollection.cs
- EffectiveValueEntry.cs
- StorageBasedPackageProperties.cs
- ChtmlCommandAdapter.cs
- ClipboardProcessor.cs