Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Data / System / Data / Common / DBConnection.cs / 2 / DBConnection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //[....] //----------------------------------------------------------------------------- namespace System.Data.Common { using System; using System.ComponentModel; using System.Data; #if WINFSInternalOnly internal #else public #endif abstract class DbConnection : Component, IDbConnection { // V1.2.3300 private StateChangeEventHandler _stateChangeEventHandler; protected DbConnection() : base() { } [ DefaultValue(""), RecommendedAsConfigurable(true), RefreshProperties(RefreshProperties.All), ResCategoryAttribute(Res.DataCategory_Data), ] abstract public string ConnectionString { get; set; } [ ResCategoryAttribute(Res.DataCategory_Data), ] virtual public int ConnectionTimeout { get { return ADP.DefaultConnectionTimeout; } } [ ResCategoryAttribute(Res.DataCategory_Data), ] abstract public string Database { get; } [ ResCategoryAttribute(Res.DataCategory_Data), ] abstract public string DataSource { // NOTE: if you plan on allowing the data source to be changed, you // should implement a ChangeDataSource method, in keeping with // the ChangeDatabase method paradigm. get; } ////// The associated provider factory for derived class. /// virtual protected DbProviderFactory DbProviderFactory { get { return null; } } internal DbProviderFactory ProviderFactory { get { return DbProviderFactory; } } [ Browsable(false), ] abstract public string ServerVersion { get; } [ Browsable(false), ResDescriptionAttribute(Res.DbConnection_State), ] abstract public ConnectionState State { get; } [ ResCategoryAttribute(Res.DataCategory_StateChange), ResDescriptionAttribute(Res.DbConnection_StateChange), ] virtual public event StateChangeEventHandler StateChange { add { _stateChangeEventHandler += value; } remove { _stateChangeEventHandler -= value; } } abstract protected DbTransaction BeginDbTransaction(IsolationLevel isolationLevel); public DbTransaction BeginTransaction() { return BeginDbTransaction(IsolationLevel.Unspecified); } public DbTransaction BeginTransaction(IsolationLevel isolationLevel) { return BeginDbTransaction(isolationLevel); } IDbTransaction IDbConnection.BeginTransaction() { return BeginDbTransaction(IsolationLevel.Unspecified); } IDbTransaction IDbConnection.BeginTransaction(IsolationLevel isolationLevel) { return BeginDbTransaction(isolationLevel); } abstract public void Close(); abstract public void ChangeDatabase(string databaseName); public DbCommand CreateCommand() { return CreateDbCommand(); } IDbCommand IDbConnection.CreateCommand() { return CreateDbCommand(); } abstract protected DbCommand CreateDbCommand(); virtual public void EnlistTransaction(System.Transactions.Transaction transaction) { // NOTE: This is virtual because not all providers may choose to support // distributed transactions. throw ADP.NotSupported(); } // these need to be here so that GetSchema is visible when programming to a dbConnection object. // they are overridden by the real implementations in DbConnectionBase virtual public DataTable GetSchema() { throw ADP.NotSupported(); } virtual public DataTable GetSchema(string collectionName) { throw ADP.NotSupported(); } virtual public DataTable GetSchema(string collectionName, string[] restrictionValues ) { throw ADP.NotSupported(); } protected virtual void OnStateChange(StateChangeEventArgs stateChange) { StateChangeEventHandler handler = _stateChangeEventHandler; if (null != handler) { handler(this, stateChange); } } abstract public void Open(); } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FormsAuthenticationTicket.cs
- AssociationSetMetadata.cs
- DependencyPropertyAttribute.cs
- DocumentOrderQuery.cs
- MeasureItemEvent.cs
- dataprotectionpermissionattribute.cs
- RenderData.cs
- StyleHelper.cs
- XmlTypeAttribute.cs
- BulletChrome.cs
- QilLoop.cs
- ToolStripDropDownClosingEventArgs.cs
- RuntimeIdentifierPropertyAttribute.cs
- ListBase.cs
- BatchParser.cs
- xsdvalidator.cs
- DataServiceContext.cs
- ControlUtil.cs
- ThreadStateException.cs
- HtmlLink.cs
- DBPropSet.cs
- SvcMapFile.cs
- XmlReflectionImporter.cs
- XPathConvert.cs
- WindowsToolbarItemAsMenuItem.cs
- ButtonBaseAutomationPeer.cs
- XmlSchemaExternal.cs
- ProxyElement.cs
- RoleGroupCollection.cs
- TypeForwardedToAttribute.cs
- XmlUnspecifiedAttribute.cs
- TextEditorTables.cs
- SessionStateSection.cs
- DropTarget.cs
- LayoutUtils.cs
- IxmlLineInfo.cs
- ExtractedStateEntry.cs
- RadioButtonList.cs
- ModelVisual3D.cs
- GradientBrush.cs
- AudioFormatConverter.cs
- securitycriticaldata.cs
- FormsAuthenticationUser.cs
- HitTestWithGeometryDrawingContextWalker.cs
- ServiceOperationDetailViewControl.cs
- BufferedReadStream.cs
- NegatedCellConstant.cs
- CharacterBuffer.cs
- Group.cs
- SamlAssertion.cs
- SequentialOutput.cs
- BasicAsyncResult.cs
- WindowClosedEventArgs.cs
- InternalPermissions.cs
- SkipStoryboardToFill.cs
- _FixedSizeReader.cs
- WSHttpBindingCollectionElement.cs
- MSAANativeProvider.cs
- FeatureSupport.cs
- SafeCryptoHandles.cs
- SpeakProgressEventArgs.cs
- AddingNewEventArgs.cs
- MergeFilterQuery.cs
- ClientTarget.cs
- elementinformation.cs
- ImageListDesigner.cs
- ClientSideProviderDescription.cs
- RtfControlWordInfo.cs
- WebPartAddingEventArgs.cs
- BinarySerializer.cs
- DataServiceResponse.cs
- PartitionedStreamMerger.cs
- ColorContextHelper.cs
- SqlBuffer.cs
- CharacterShapingProperties.cs
- HwndSource.cs
- OdbcTransaction.cs
- ListBoxChrome.cs
- AppDomainUnloadedException.cs
- DrawingAttributesDefaultValueFactory.cs
- Visual3DCollection.cs
- MulticastNotSupportedException.cs
- XmlSchemaAttributeGroupRef.cs
- DisableDpiAwarenessAttribute.cs
- HwndHost.cs
- XmlSchemaInferenceException.cs
- ObjectStateEntryDbDataRecord.cs
- FutureFactory.cs
- BitmapImage.cs
- DataGridColumnCollection.cs
- OdbcErrorCollection.cs
- OdbcPermission.cs
- KeyedByTypeCollection.cs
- _CookieModule.cs
- ImplicitInputBrush.cs
- FragmentNavigationEventArgs.cs
- DataControlButton.cs
- ComponentCommands.cs
- EventMap.cs
- MultiViewDesigner.cs