Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Data / System / Data / Odbc / OdbcConnectionString.cs / 1 / OdbcConnectionString.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
// [....]
//-----------------------------------------------------------------------------
namespace System.Data.Odbc {
using System;
using System.Collections;
using System.Data;
using System.Data.Common;
using System.Security;
using System.Security.Permissions;
using System.Text;
internal sealed class OdbcConnectionString : DbConnectionOptions {
// instances of this class are intended to be immutable, i.e readonly
// used by pooling classes so it is much easier to verify correctness
// when not worried about the class being modified during execution
private static class KEY {
internal const string SaveFile = "savefile";
}
private readonly string _expandedConnectionString;
internal OdbcConnectionString(string connectionString, bool validate) : base(connectionString, null, true) {
if (!validate) {
string filename = null;
int position = 0;
_expandedConnectionString = ExpandDataDirectories(ref filename, ref position);
}
if (validate || (null == _expandedConnectionString)) {
// do not check string length if it was expanded because the final result may be shorter than the original
if ((null != connectionString) && (ODBC32.MAX_CONNECTION_STRING_LENGTH < connectionString.Length)) { // MDAC 83536
throw ODBC.ConnectionStringTooLong();
}
}
}
protected internal override System.Security.PermissionSet CreatePermissionSet() {
System.Security.PermissionSet permissionSet;
if (ContainsKey(KEY.SaveFile)) {
permissionSet = new NamedPermissionSet("FullTrust");
}
else {
permissionSet = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.None);
permissionSet.AddPermission(new OdbcPermission(this));
}
return permissionSet;
}
protected internal override string Expand() {
if (null != _expandedConnectionString) {
return _expandedConnectionString;
}
else {
return base.Expand();
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
// [....]
//-----------------------------------------------------------------------------
namespace System.Data.Odbc {
using System;
using System.Collections;
using System.Data;
using System.Data.Common;
using System.Security;
using System.Security.Permissions;
using System.Text;
internal sealed class OdbcConnectionString : DbConnectionOptions {
// instances of this class are intended to be immutable, i.e readonly
// used by pooling classes so it is much easier to verify correctness
// when not worried about the class being modified during execution
private static class KEY {
internal const string SaveFile = "savefile";
}
private readonly string _expandedConnectionString;
internal OdbcConnectionString(string connectionString, bool validate) : base(connectionString, null, true) {
if (!validate) {
string filename = null;
int position = 0;
_expandedConnectionString = ExpandDataDirectories(ref filename, ref position);
}
if (validate || (null == _expandedConnectionString)) {
// do not check string length if it was expanded because the final result may be shorter than the original
if ((null != connectionString) && (ODBC32.MAX_CONNECTION_STRING_LENGTH < connectionString.Length)) { // MDAC 83536
throw ODBC.ConnectionStringTooLong();
}
}
}
protected internal override System.Security.PermissionSet CreatePermissionSet() {
System.Security.PermissionSet permissionSet;
if (ContainsKey(KEY.SaveFile)) {
permissionSet = new NamedPermissionSet("FullTrust");
}
else {
permissionSet = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.None);
permissionSet.AddPermission(new OdbcPermission(this));
}
return permissionSet;
}
protected internal override string Expand() {
if (null != _expandedConnectionString) {
return _expandedConnectionString;
}
else {
return base.Expand();
}
}
}
}
// 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
- LayoutExceptionEventArgs.cs
- HandleCollector.cs
- LineMetrics.cs
- TextRangeSerialization.cs
- ForeignKeyConstraint.cs
- PersonalizationDictionary.cs
- Encoding.cs
- MarkupProperty.cs
- SqlMethodTransformer.cs
- AssemblyName.cs
- WebProxyScriptElement.cs
- InstanceNotFoundException.cs
- PriorityRange.cs
- CounterCreationDataConverter.cs
- FixedPosition.cs
- SID.cs
- UIPermission.cs
- AesManaged.cs
- ErrorLog.cs
- EventDescriptor.cs
- PriorityQueue.cs
- XmlReader.cs
- COM2ExtendedTypeConverter.cs
- SkewTransform.cs
- PersonalizationEntry.cs
- ExpressionBinding.cs
- ellipse.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- HttpsHostedTransportConfiguration.cs
- GeometryDrawing.cs
- ExpandCollapsePattern.cs
- ConfigurationProperty.cs
- TreeNodeEventArgs.cs
- ColumnWidthChangingEvent.cs
- Rfc4050KeyFormatter.cs
- ScrollableControlDesigner.cs
- DataGridItemAttachedStorage.cs
- ManagedIStream.cs
- DataObjectPastingEventArgs.cs
- DataPagerFieldCollection.cs
- RtfToken.cs
- PersianCalendar.cs
- DateTimeFormat.cs
- Container.cs
- PointCollection.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- SafeBitVector32.cs
- ButtonField.cs
- DataGridViewColumn.cs
- TextTreeDeleteContentUndoUnit.cs
- PersonalizationDictionary.cs
- MimeWriter.cs
- MorphHelpers.cs
- ELinqQueryState.cs
- WaitHandle.cs
- ComponentManagerBroker.cs
- CompilerState.cs
- WorkerRequest.cs
- SystemThemeKey.cs
- WebPartChrome.cs
- SectionUpdates.cs
- PointAnimationClockResource.cs
- FileSystemEnumerable.cs
- WebPartZone.cs
- AnimatedTypeHelpers.cs
- TextServicesContext.cs
- WorkflowInstance.cs
- EdgeModeValidation.cs
- CryptoProvider.cs
- KeyValueConfigurationElement.cs
- TextWriterEngine.cs
- GraphicsPath.cs
- XPathAxisIterator.cs
- SafeIUnknown.cs
- PageHandlerFactory.cs
- PasswordRecovery.cs
- EditorPartChrome.cs
- RadialGradientBrush.cs
- ParseChildrenAsPropertiesAttribute.cs
- SemaphoreFullException.cs
- arabicshape.cs
- externdll.cs
- SqlDependency.cs
- ChangeBlockUndoRecord.cs
- CursorConverter.cs
- DesignBindingEditor.cs
- TextOutput.cs
- KeyGesture.cs
- Restrictions.cs
- ResourceDefaultValueAttribute.cs
- BooleanSwitch.cs
- RouteItem.cs
- XmlImplementation.cs
- ListItemConverter.cs
- RichTextBox.cs
- PeerTransportListenAddressValidatorAttribute.cs
- InternalControlCollection.cs
- StrokeCollectionConverter.cs
- DataObjectMethodAttribute.cs
- SchemaEntity.cs