Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Data / System / Data / Common / DBConnection.cs / 1305376 / DBConnection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //[....] //----------------------------------------------------------------------------- namespace System.Data.Common { using System; using System.ComponentModel; using System.Data; public abstract class DbConnection : Component, IDbConnection { // V1.2.3300 private StateChangeEventHandler _stateChangeEventHandler; protected DbConnection() : base() { } [ DefaultValue(""), #pragma warning disable 618 // ignore obsolete warning about RecommendedAsConfigurable to use SettingsBindableAttribute RecommendedAsConfigurable(true), #pragma warning restore 618 SettingsBindableAttribute(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. // //[....] //[....] //[....] //----------------------------------------------------------------------------- namespace System.Data.Common { using System; using System.ComponentModel; using System.Data; public abstract class DbConnection : Component, IDbConnection { // V1.2.3300 private StateChangeEventHandler _stateChangeEventHandler; protected DbConnection() : base() { } [ DefaultValue(""), #pragma warning disable 618 // ignore obsolete warning about RecommendedAsConfigurable to use SettingsBindableAttribute RecommendedAsConfigurable(true), #pragma warning restore 618 SettingsBindableAttribute(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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PeerChannelListener.cs
- HebrewNumber.cs
- PreservationFileWriter.cs
- ZipIOExtraFieldZip64Element.cs
- KeyGestureValueSerializer.cs
- NamedObject.cs
- ChannelEndpointElement.cs
- SqlConnectionFactory.cs
- ProcessManager.cs
- OleDbDataAdapter.cs
- SchemaAttDef.cs
- DataKeyPropertyAttribute.cs
- QueryOperationResponseOfT.cs
- AvtEvent.cs
- ExpandButtonVisibilityConverter.cs
- KeyboardEventArgs.cs
- StylusCollection.cs
- SerialReceived.cs
- WindowsAuthenticationEventArgs.cs
- FlagsAttribute.cs
- GridViewColumnHeader.cs
- ParameterCollectionEditor.cs
- RadioButtonAutomationPeer.cs
- BoolExpressionVisitors.cs
- ItemContainerGenerator.cs
- NullableConverter.cs
- Rect3D.cs
- TraceSection.cs
- BigInt.cs
- PanelStyle.cs
- UserControlBuildProvider.cs
- HandlerBase.cs
- CharUnicodeInfo.cs
- DeclarationUpdate.cs
- ToolStripSplitStackLayout.cs
- BehaviorEditorPart.cs
- Point4DValueSerializer.cs
- WinInetCache.cs
- Compilation.cs
- NonParentingControl.cs
- DisplayNameAttribute.cs
- MeshGeometry3D.cs
- ToolStripContainer.cs
- FeatureManager.cs
- InternalControlCollection.cs
- EndpointInstanceProvider.cs
- AQNBuilder.cs
- NameScope.cs
- ClickablePoint.cs
- ServiceDurableInstance.cs
- ProgressiveCrcCalculatingStream.cs
- ComIntegrationManifestGenerator.cs
- CodeTypeOfExpression.cs
- XamlPoint3DCollectionSerializer.cs
- Visual3D.cs
- Help.cs
- TextEditorCopyPaste.cs
- ProgramNode.cs
- Application.cs
- EntityContainer.cs
- WhitespaceRuleLookup.cs
- ImageCodecInfoPrivate.cs
- ContactManager.cs
- ComponentEditorPage.cs
- FixedBufferAttribute.cs
- PrintEvent.cs
- ObjectNotFoundException.cs
- XmlSchemaObjectTable.cs
- BinHexDecoder.cs
- QueryConverter.cs
- externdll.cs
- NativeMethods.cs
- WaitHandle.cs
- WebServicesDescriptionAttribute.cs
- PageBuildProvider.cs
- NameObjectCollectionBase.cs
- TypeBuilder.cs
- FileLevelControlBuilderAttribute.cs
- ContentOperations.cs
- DownloadProgressEventArgs.cs
- AssemblyCache.cs
- MonthChangedEventArgs.cs
- PeerNameRecordCollection.cs
- FrameworkReadOnlyPropertyMetadata.cs
- PathGeometry.cs
- ToolStripItemImageRenderEventArgs.cs
- FunctionCommandText.cs
- SQLRoleProvider.cs
- ContourSegment.cs
- LambdaSerializationException.cs
- TextEditorCopyPaste.cs
- XsltSettings.cs
- SurrogateDataContract.cs
- EditorPart.cs
- UnsafePeerToPeerMethods.cs
- DiscreteKeyFrames.cs
- CompositeFontInfo.cs
- SetterBase.cs
- ClrPerspective.cs
- DataGridCell.cs