Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Data / System / Data / Odbc / OdbcConnectionOpen.cs / 1 / OdbcConnectionOpen.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- using System; using System.Data; using System.Data.Common; using System.Data.ProviderBase; using System.Threading; using SysTx = System.Transactions; namespace System.Data.Odbc { sealed internal class OdbcConnectionOpen : DbConnectionInternal { // Construct from a compiled connection string internal OdbcConnectionOpen(OdbcConnection outerConnection, OdbcConnectionString connectionOptions) { #if DEBUG try { // use this to help validate this object is only created after the following permission has been previously demanded in the current codepath if (null != outerConnection) { outerConnection.UserConnectionOptions.DemandPermission(); } else { connectionOptions.DemandPermission(); } } catch(System.Security.SecurityException) { System.Diagnostics.Debug.Assert(false, "unexpected SecurityException for current codepath"); throw; } #endif OdbcEnvironmentHandle environmentHandle = OdbcEnvironment.GetGlobalEnvironmentHandle(); outerConnection.ConnectionHandle = new OdbcConnectionHandle(outerConnection, connectionOptions, environmentHandle); } internal OdbcConnection OuterConnection { get { OdbcConnection outerConnection = (OdbcConnection)Owner; if (null == outerConnection) throw ADP.InvalidOperation("internal connection without an outer connection?"); // return outerConnection; } } override public string ServerVersion { get { return OuterConnection.Open_GetServerVersion(); } } override protected void Activate(SysTx.Transaction transaction) { OdbcConnection.ExecutePermission.Demand(); } override public DbTransaction BeginTransaction(IsolationLevel isolevel) { return BeginOdbcTransaction(isolevel); } internal OdbcTransaction BeginOdbcTransaction(IsolationLevel isolevel) { return OuterConnection.Open_BeginTransaction(isolevel); } override public void ChangeDatabase(string value) { OuterConnection.Open_ChangeDatabase(value); } override protected DbReferenceCollection CreateReferenceCollection() { return new OdbcReferenceCollection(); } override protected void Deactivate() { NotifyWeakReference(OdbcReferenceCollection.Closing); } override public void EnlistTransaction(SysTx.Transaction transaction) { OuterConnection.Open_EnlistTransaction(transaction); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- using System; using System.Data; using System.Data.Common; using System.Data.ProviderBase; using System.Threading; using SysTx = System.Transactions; namespace System.Data.Odbc { sealed internal class OdbcConnectionOpen : DbConnectionInternal { // Construct from a compiled connection string internal OdbcConnectionOpen(OdbcConnection outerConnection, OdbcConnectionString connectionOptions) { #if DEBUG try { // use this to help validate this object is only created after the following permission has been previously demanded in the current codepath if (null != outerConnection) { outerConnection.UserConnectionOptions.DemandPermission(); } else { connectionOptions.DemandPermission(); } } catch(System.Security.SecurityException) { System.Diagnostics.Debug.Assert(false, "unexpected SecurityException for current codepath"); throw; } #endif OdbcEnvironmentHandle environmentHandle = OdbcEnvironment.GetGlobalEnvironmentHandle(); outerConnection.ConnectionHandle = new OdbcConnectionHandle(outerConnection, connectionOptions, environmentHandle); } internal OdbcConnection OuterConnection { get { OdbcConnection outerConnection = (OdbcConnection)Owner; if (null == outerConnection) throw ADP.InvalidOperation("internal connection without an outer connection?"); // return outerConnection; } } override public string ServerVersion { get { return OuterConnection.Open_GetServerVersion(); } } override protected void Activate(SysTx.Transaction transaction) { OdbcConnection.ExecutePermission.Demand(); } override public DbTransaction BeginTransaction(IsolationLevel isolevel) { return BeginOdbcTransaction(isolevel); } internal OdbcTransaction BeginOdbcTransaction(IsolationLevel isolevel) { return OuterConnection.Open_BeginTransaction(isolevel); } override public void ChangeDatabase(string value) { OuterConnection.Open_ChangeDatabase(value); } override protected DbReferenceCollection CreateReferenceCollection() { return new OdbcReferenceCollection(); } override protected void Deactivate() { NotifyWeakReference(OdbcReferenceCollection.Closing); } override public void EnlistTransaction(SysTx.Transaction transaction) { OuterConnection.Open_EnlistTransaction(transaction); } } } // 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
- MouseButtonEventArgs.cs
- Panel.cs
- DataGridViewRowStateChangedEventArgs.cs
- InputEventArgs.cs
- SafeTimerHandle.cs
- X509UI.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- SafeLibraryHandle.cs
- TempFiles.cs
- ColorBlend.cs
- AppearanceEditorPart.cs
- CommandLibraryHelper.cs
- DataKey.cs
- MachineSettingsSection.cs
- ExpressionPrefixAttribute.cs
- DateTimeSerializationSection.cs
- ObjectTypeMapping.cs
- PartialTrustHelpers.cs
- BulletDecorator.cs
- SymDocumentType.cs
- _RequestCacheProtocol.cs
- DelegatingTypeDescriptionProvider.cs
- ElementsClipboardData.cs
- HwndAppCommandInputProvider.cs
- WebPartConnectionsConfigureVerb.cs
- String.cs
- WmpBitmapDecoder.cs
- Parameter.cs
- IISMapPath.cs
- ArgumentNullException.cs
- CodeMemberProperty.cs
- GradientStop.cs
- RepeaterDesigner.cs
- ProfilePropertyNameValidator.cs
- TextTreeUndo.cs
- HttpValueCollection.cs
- TypeNameParser.cs
- DataServiceBehavior.cs
- SafeCancelMibChangeNotify.cs
- Vector.cs
- Glyph.cs
- DispatcherProcessingDisabled.cs
- ConfigurationFileMap.cs
- DataGridCellAutomationPeer.cs
- StreamWithDictionary.cs
- ElementProxy.cs
- OperationExecutionFault.cs
- CreatingCookieEventArgs.cs
- DbConnectionPoolGroupProviderInfo.cs
- ObjectViewEntityCollectionData.cs
- DesignerDataConnection.cs
- MetadataArtifactLoaderCompositeFile.cs
- HttpResponseInternalWrapper.cs
- CheckableControlBaseAdapter.cs
- HandlerFactoryCache.cs
- NamespaceCollection.cs
- ClientSettings.cs
- FontCacheUtil.cs
- AnimationClock.cs
- SelectionRange.cs
- DesignOnlyAttribute.cs
- PointIndependentAnimationStorage.cs
- XmlSchemaExternal.cs
- UrlPath.cs
- XmlHierarchyData.cs
- lengthconverter.cs
- TableMethodGenerator.cs
- DNS.cs
- SHA384Managed.cs
- UnsafeNetInfoNativeMethods.cs
- XmlIncludeAttribute.cs
- Int16Storage.cs
- RequestStatusBarUpdateEventArgs.cs
- CompiledRegexRunnerFactory.cs
- SqlBulkCopyColumnMappingCollection.cs
- AbandonedMutexException.cs
- CookielessHelper.cs
- DeflateInput.cs
- GridPattern.cs
- HtmlTextArea.cs
- ConfigurationStrings.cs
- SupportsEventValidationAttribute.cs
- TextDecorations.cs
- Intellisense.cs
- ServiceControllerDesigner.cs
- SchemaDeclBase.cs
- View.cs
- ProfileParameter.cs
- DialogWindow.cs
- BackgroundFormatInfo.cs
- ConnectionConsumerAttribute.cs
- KeyGesture.cs
- EntityContainerAssociationSet.cs
- TabRenderer.cs
- FileDialogCustomPlacesCollection.cs
- ToolboxBitmapAttribute.cs
- DataControlButton.cs
- AccessDataSourceDesigner.cs
- GridViewRowPresenter.cs
- ArithmeticException.cs