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 / 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
- CodeAccessSecurityEngine.cs
- BinaryObjectInfo.cs
- TextElement.cs
- DataObject.cs
- ExecutionContext.cs
- KeyInterop.cs
- Wildcard.cs
- CommandExpr.cs
- TypeConverterAttribute.cs
- RequiredFieldValidator.cs
- DateTimeParse.cs
- UICuesEvent.cs
- ListenerTraceUtility.cs
- StateMachine.cs
- UnconditionalPolicy.cs
- GAC.cs
- smtpconnection.cs
- SessionPageStatePersister.cs
- SqlUserDefinedAggregateAttribute.cs
- WorkflowDesigner.cs
- DataGridViewIntLinkedList.cs
- TextElementEnumerator.cs
- CurrentChangedEventManager.cs
- SqlMethodAttribute.cs
- DictionaryCustomTypeDescriptor.cs
- TemplatedMailWebEventProvider.cs
- WebPartConnectionCollection.cs
- SQLByteStorage.cs
- MetadataItemSerializer.cs
- DurableEnlistmentState.cs
- ProcessModuleCollection.cs
- relpropertyhelper.cs
- MailDefinition.cs
- ListBase.cs
- OracleParameterBinding.cs
- OperandQuery.cs
- SamlAssertionKeyIdentifierClause.cs
- FixedSOMLineCollection.cs
- DragEvent.cs
- AsyncResult.cs
- DragStartedEventArgs.cs
- WebWorkflowRole.cs
- ProtectedConfiguration.cs
- WindowsEditBox.cs
- AnnotationObservableCollection.cs
- EventHandlerList.cs
- WindowExtensionMethods.cs
- EditorZoneBase.cs
- NullReferenceException.cs
- CodeIndexerExpression.cs
- AccessibleObject.cs
- MouseEventArgs.cs
- XamlClipboardData.cs
- DesignerCategoryAttribute.cs
- StringDictionaryWithComparer.cs
- MatchingStyle.cs
- GridViewColumn.cs
- BeginCreateSecurityTokenRequest.cs
- httpstaticobjectscollection.cs
- InProcStateClientManager.cs
- Adorner.cs
- CompiledQueryCacheEntry.cs
- ObjectConverter.cs
- XmlUtil.cs
- SecurityState.cs
- TextViewElement.cs
- StructuredTypeEmitter.cs
- JsonXmlDataContract.cs
- CharacterString.cs
- DesignerDataView.cs
- SafeArrayTypeMismatchException.cs
- ReferenceEqualityComparer.cs
- FormsIdentity.cs
- GlobalEventManager.cs
- StatusBarItemAutomationPeer.cs
- FrameworkElementAutomationPeer.cs
- IndentedTextWriter.cs
- PropertyGridView.cs
- Select.cs
- IpcClientManager.cs
- NoClickablePointException.cs
- WebMessageEncodingElement.cs
- CurrentChangedEventManager.cs
- BinaryUtilClasses.cs
- Parameter.cs
- DataGridViewCellCollection.cs
- EventLogPermissionEntry.cs
- InputReportEventArgs.cs
- TypeExtensionConverter.cs
- ToolStripControlHost.cs
- CodeTryCatchFinallyStatement.cs
- WebPartDisplayModeEventArgs.cs
- Material.cs
- ReadOnlyMetadataCollection.cs
- WebPartZoneBase.cs
- TextElementAutomationPeer.cs
- Calendar.cs
- FastPropertyAccessor.cs
- RoutingService.cs
- ObservableCollection.cs