Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Data / System / Data / Odbc / OdbcConnectionOpen.cs / 1305376 / 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
- QueryAsyncResult.cs
- GeometryConverter.cs
- CompilationSection.cs
- AnnotationHelper.cs
- BooleanProjectedSlot.cs
- FlowDocumentReader.cs
- ObjectPersistData.cs
- DebugHandleTracker.cs
- EnvelopedSignatureTransform.cs
- CompilationUnit.cs
- MethodCallConverter.cs
- TableLayoutSettingsTypeConverter.cs
- ProfileSettingsCollection.cs
- IndependentlyAnimatedPropertyMetadata.cs
- JsonGlobals.cs
- ResizeGrip.cs
- ExtenderProvidedPropertyAttribute.cs
- FixedFindEngine.cs
- ScrollEventArgs.cs
- Pair.cs
- WebPartDescriptionCollection.cs
- SqlDeflator.cs
- CustomValidator.cs
- UserInitiatedNavigationPermission.cs
- NeutralResourcesLanguageAttribute.cs
- TextAction.cs
- StringUtil.cs
- BitmapCodecInfo.cs
- TimeSpanMinutesConverter.cs
- odbcmetadatacollectionnames.cs
- LinkClickEvent.cs
- ListViewDeletedEventArgs.cs
- Error.cs
- Publisher.cs
- MenuScrollingVisibilityConverter.cs
- CoreSwitches.cs
- AttributeCollection.cs
- PrefixQName.cs
- ThreadPool.cs
- ComponentResourceKeyConverter.cs
- NamedPipeConnectionPoolSettings.cs
- TreeViewAutomationPeer.cs
- HttpCookiesSection.cs
- DecodeHelper.cs
- XPathNavigator.cs
- WebPartTransformer.cs
- RowParagraph.cs
- ChildrenQuery.cs
- RouteData.cs
- SqlStream.cs
- StoreAnnotationsMap.cs
- XmlSchemaSequence.cs
- BuildProviderAppliesToAttribute.cs
- PropertyMetadata.cs
- Content.cs
- BrushConverter.cs
- ExceptionTrace.cs
- DataException.cs
- ScrollBar.cs
- AxisAngleRotation3D.cs
- ReadOnlyPropertyMetadata.cs
- VectorKeyFrameCollection.cs
- DetailsViewUpdateEventArgs.cs
- CellNormalizer.cs
- Container.cs
- CommonGetThemePartSize.cs
- DropSourceBehavior.cs
- SoapServerMethod.cs
- GrammarBuilderPhrase.cs
- InvariantComparer.cs
- Parameter.cs
- ProcessStartInfo.cs
- SqlMultiplexer.cs
- SignedXmlDebugLog.cs
- RuntimeConfigurationRecord.cs
- AppDomainUnloadedException.cs
- TextServicesDisplayAttributePropertyRanges.cs
- Constant.cs
- DirectoryNotFoundException.cs
- NamespaceCollection.cs
- SHA1.cs
- EntryIndex.cs
- HttpDebugHandler.cs
- WindowsContainer.cs
- regiisutil.cs
- Currency.cs
- EditorZoneDesigner.cs
- StatusBarAutomationPeer.cs
- PresentationAppDomainManager.cs
- MessageEncoder.cs
- ColumnResizeUndoUnit.cs
- WindowHideOrCloseTracker.cs
- DataGridPagerStyle.cs
- DrawingContextDrawingContextWalker.cs
- ObfuscationAttribute.cs
- CodePageUtils.cs
- DynamicRendererThreadManager.cs
- ValueQuery.cs
- WizardStepBase.cs
- Tile.cs