Code:
/ 4.0 / 4.0 / 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. //------------------------------------------------------------------------------ //// 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
- ModelTreeManager.cs
- ThicknessConverter.cs
- ControlBindingsCollection.cs
- Query.cs
- ADMembershipProvider.cs
- ImageIndexEditor.cs
- StructuralType.cs
- XmlSchemaSet.cs
- SapiRecognizer.cs
- TextInfo.cs
- PingReply.cs
- ConstraintStruct.cs
- TypeSystem.cs
- RightsManagementPermission.cs
- ZeroOpNode.cs
- ViewGenerator.cs
- IsolationInterop.cs
- ScalarType.cs
- DelimitedListTraceListener.cs
- ScrollProviderWrapper.cs
- GridViewRowCollection.cs
- GorillaCodec.cs
- TrackBarRenderer.cs
- TaskFormBase.cs
- GuidConverter.cs
- DataMisalignedException.cs
- Byte.cs
- ObfuscationAttribute.cs
- FontStretchConverter.cs
- DayRenderEvent.cs
- RelationshipSet.cs
- IResourceProvider.cs
- PersistChildrenAttribute.cs
- OleDbCommandBuilder.cs
- Timer.cs
- _HelperAsyncResults.cs
- PropertyRecord.cs
- InheritanceService.cs
- EventBuilder.cs
- EditingCoordinator.cs
- ClientRolePrincipal.cs
- RequestStatusBarUpdateEventArgs.cs
- ElasticEase.cs
- ProtocolElement.cs
- ChtmlFormAdapter.cs
- SizeF.cs
- WebPartCollection.cs
- BitmapPalette.cs
- ProtocolsConfigurationHandler.cs
- TimelineCollection.cs
- MenuAutomationPeer.cs
- TaskHelper.cs
- UIntPtr.cs
- PreProcessInputEventArgs.cs
- OnOperation.cs
- MissingMemberException.cs
- AutomationAttributeInfo.cs
- Queue.cs
- LoginViewDesigner.cs
- NativeMethods.cs
- AdapterDictionary.cs
- WorkflowViewService.cs
- coordinatorfactory.cs
- LifetimeMonitor.cs
- ArrayList.cs
- TaskFormBase.cs
- CodeTypeDelegate.cs
- NamedElement.cs
- IntegrationExceptionEventArgs.cs
- XmlReturnReader.cs
- XmlValidatingReader.cs
- StateFinalizationDesigner.cs
- HorizontalAlignConverter.cs
- XPathBinder.cs
- JavaScriptSerializer.cs
- SpellerStatusTable.cs
- FormViewCommandEventArgs.cs
- ControlPaint.cs
- DesignParameter.cs
- ToolStripComboBox.cs
- EndGetFileNameFromUserRequest.cs
- DbProviderFactory.cs
- XPathQilFactory.cs
- StringComparer.cs
- HttpRuntimeSection.cs
- XhtmlBasicValidationSummaryAdapter.cs
- _NestedMultipleAsyncResult.cs
- DrawingAttributesDefaultValueFactory.cs
- OutputCacheSection.cs
- DataTableCollection.cs
- AssemblyNameProxy.cs
- ReferenceConverter.cs
- GridViewRowCollection.cs
- HealthMonitoringSectionHelper.cs
- ChineseLunisolarCalendar.cs
- EntityDataSource.cs
- PeerContact.cs
- EventPropertyMap.cs
- ApplicationDirectory.cs
- UriTemplateTableMatchCandidate.cs