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 / Common / DBConnection.cs / 1 / 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
- XdrBuilder.cs
- UnsafeNativeMethodsCLR.cs
- TransformCollection.cs
- ObjectRef.cs
- DynamicControlParameter.cs
- QilGeneratorEnv.cs
- SvcMapFileSerializer.cs
- Annotation.cs
- SchemaImporterExtensionElement.cs
- WindowsRichEditRange.cs
- _UriTypeConverter.cs
- ExpandoClass.cs
- ScriptResourceHandler.cs
- ImageBrush.cs
- XmlAtomErrorReader.cs
- CompensateDesigner.cs
- MouseGestureValueSerializer.cs
- _LoggingObject.cs
- TrustManagerPromptUI.cs
- DataColumnCollection.cs
- MiniCustomAttributeInfo.cs
- CellParagraph.cs
- PropertyCondition.cs
- ConsoleKeyInfo.cs
- Accessible.cs
- RightsManagementUser.cs
- ToolStripItemGlyph.cs
- __ComObject.cs
- XmlSchemaSequence.cs
- DataPagerCommandEventArgs.cs
- HttpApplication.cs
- UserControl.cs
- ToolStripGrip.cs
- StructuralCache.cs
- EdmSchemaError.cs
- TemplateParser.cs
- recordstate.cs
- SafePEFileHandle.cs
- TransactionScope.cs
- ContainerVisual.cs
- ApplicationInfo.cs
- VectorAnimationBase.cs
- ServiceRoute.cs
- StorageModelBuildProvider.cs
- TextTreeFixupNode.cs
- AlternateView.cs
- WebPartConnectionsCloseVerb.cs
- RemoteTokenFactory.cs
- RayMeshGeometry3DHitTestResult.cs
- ListViewHitTestInfo.cs
- EventItfInfo.cs
- ConfigurationSectionGroupCollection.cs
- ScrollItemProviderWrapper.cs
- FixedNode.cs
- DebugView.cs
- DesignerActionItemCollection.cs
- embossbitmapeffect.cs
- XmlSecureResolver.cs
- NameObjectCollectionBase.cs
- HtmlInputControl.cs
- Bidi.cs
- StringResourceManager.cs
- TreeView.cs
- DataSourceView.cs
- RealizedColumnsBlock.cs
- AuthenticationModulesSection.cs
- DefaultValueAttribute.cs
- DrawListViewItemEventArgs.cs
- DurationConverter.cs
- WizardForm.cs
- AnnotationStore.cs
- EdmMember.cs
- WhitespaceRule.cs
- ThreadInterruptedException.cs
- GroupByExpressionRewriter.cs
- _TimerThread.cs
- SqlMethodAttribute.cs
- ObjectContextServiceProvider.cs
- XamlInt32CollectionSerializer.cs
- WebPartMinimizeVerb.cs
- SortDescription.cs
- ImageUrlEditor.cs
- PropertyChange.cs
- AssemblyBuilderData.cs
- AutomationElementCollection.cs
- InputLangChangeEvent.cs
- WindowsAltTab.cs
- ConfigXmlText.cs
- ChildDocumentBlock.cs
- ArrowControl.xaml.cs
- ComplexTypeEmitter.cs
- Quad.cs
- WindowsGraphicsWrapper.cs
- ProcessThreadDesigner.cs
- ToolStripRenderer.cs
- PasswordPropertyTextAttribute.cs
- WebScriptEndpointElement.cs
- Comparer.cs
- ToolStripItemClickedEventArgs.cs
- DesignerObject.cs