Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Data / System / Data / Common / DBConnection.cs / 5 / 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. // //[....] //[....] //[....] //----------------------------------------------------------------------------- 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DataProviderNameConverter.cs
- WebControlParameterProxy.cs
- SQLSingleStorage.cs
- Stopwatch.cs
- SemaphoreFullException.cs
- FrameworkTemplate.cs
- DelayedRegex.cs
- CryptoApi.cs
- WindowsToolbarItemAsMenuItem.cs
- Hash.cs
- TreeNodeCollection.cs
- unitconverter.cs
- NominalTypeEliminator.cs
- SourceFileBuildProvider.cs
- CompModHelpers.cs
- IssuanceTokenProviderState.cs
- ImmComposition.cs
- UpdatePanelControlTrigger.cs
- DataControlButton.cs
- BuildProviderAppliesToAttribute.cs
- ReturnType.cs
- TransformDescriptor.cs
- _Rfc2616CacheValidators.cs
- IBuiltInEvidence.cs
- DrawListViewItemEventArgs.cs
- DependencyObjectValidator.cs
- Quad.cs
- ManagementExtension.cs
- TextRangeProviderWrapper.cs
- AssertFilter.cs
- IndexOutOfRangeException.cs
- InputBuffer.cs
- NonVisualControlAttribute.cs
- SqlBulkCopy.cs
- BindingSource.cs
- BaseDataListPage.cs
- TypeElement.cs
- ThreadStateException.cs
- SequentialActivityDesigner.cs
- DocumentOrderQuery.cs
- ResolveNameEventArgs.cs
- InvalidPrinterException.cs
- AmbientValueAttribute.cs
- Odbc32.cs
- MatrixAnimationUsingPath.cs
- ListViewCommandEventArgs.cs
- MessageDecoder.cs
- AdCreatedEventArgs.cs
- FormDocumentDesigner.cs
- ListBindingConverter.cs
- TemplatePropertyEntry.cs
- OracleTransaction.cs
- SettingsPropertyNotFoundException.cs
- Image.cs
- ErrorHandlerFaultInfo.cs
- OutputCacheSettings.cs
- PropertyIDSet.cs
- EventLogPropertySelector.cs
- XmlBindingWorker.cs
- TreeWalkHelper.cs
- TextBounds.cs
- ToolStripOverflow.cs
- ListItemCollection.cs
- Parsers.cs
- ResourceManager.cs
- WebServiceBindingAttribute.cs
- FixedFindEngine.cs
- DecimalAnimationBase.cs
- ThrowHelper.cs
- Visitor.cs
- TextParagraphProperties.cs
- WhitespaceRuleReader.cs
- CustomValidator.cs
- DependencyPropertyValueSerializer.cs
- DataGridClipboardCellContent.cs
- XXXOnTypeBuilderInstantiation.cs
- TypeNameConverter.cs
- BulletedList.cs
- WindowsSolidBrush.cs
- GrabHandleGlyph.cs
- BindingMAnagerBase.cs
- CurrencyWrapper.cs
- FileLogRecordHeader.cs
- XmlSerializationReader.cs
- XPathNodeInfoAtom.cs
- GeneralTransform3DTo2DTo3D.cs
- EntityCommandExecutionException.cs
- DependencyObjectCodeDomSerializer.cs
- EndOfStreamException.cs
- InputGestureCollection.cs
- BaseServiceProvider.cs
- XmlSchemaSimpleType.cs
- LinkedList.cs
- SupportingTokenSecurityTokenResolver.cs
- DocumentPaginator.cs
- Rotation3DAnimationBase.cs
- Action.cs
- SmtpReplyReaderFactory.cs
- MultiTrigger.cs
- XmlSchemaExternal.cs