Partager via


TeamFoundationSqlResourceComponent Class

Inheritance Hierarchy

System.Object
  Microsoft.TeamFoundation.Framework.Server.TeamFoundationSqlResourceComponent
    Microsoft.TeamFoundation.Framework.Server.ExtendedAttributeComponent
    Microsoft.TeamFoundation.Framework.Server.FrameworkSqlResourceComponent
    Microsoft.TeamFoundation.Framework.Server.ResourceManagementComponent
    Microsoft.TeamFoundation.Framework.Server.SqlScriptResourceComponent
    Microsoft.TeamFoundation.Framework.Server.TeamFoundationDataTierComponent
    Microsoft.TeamFoundation.Framework.Server.TestPartitionComponent

Namespace:  Microsoft.TeamFoundation.Framework.Server
Assembly:  Microsoft.TeamFoundation.Framework.Server (in Microsoft.TeamFoundation.Framework.Server.dll)

Syntax

'Declaration
Public MustInherit Class TeamFoundationSqlResourceComponent _
    Implements IDisposable, ICancelable
public abstract class TeamFoundationSqlResourceComponent : IDisposable, 
    ICancelable
public ref class TeamFoundationSqlResourceComponent abstract : IDisposable, 
    ICancelable
[<AbstractClass>]
type TeamFoundationSqlResourceComponent =  
    class 
        interface IDisposable 
        interface ICancelable 
    end
public abstract class TeamFoundationSqlResourceComponent implements IDisposable, ICancelable

The TeamFoundationSqlResourceComponent type exposes the following members.

Constructors

  Name Description
Protected method TeamFoundationSqlResourceComponent() Initializes a new instance of the TeamFoundationSqlResourceComponent class.If this constructor is used to instantiate the object, Initialize method must be called to finish object initialization.
Protected method TeamFoundationSqlResourceComponent(TeamFoundationRequestContext, String) Initializes a new instance of the TeamFoundationSqlResourceComponent class.

Top

Properties

  Name Description
Protected property Author The author is defined as the source of the change that caused the notification. See Author for more information.
Protected property BoundParameters Returns the number of currently bound parameters.
Protected property Command The SQL command that is used by the SqlResourceComponent.
Protected property CommandText Sql text for the current command.
Protected property CommandTimeout The CommandTimeout used for all executions unless otherwise specified for a given command.
Protected property Connection The SqlConnection used by this TeamFoundationSqlResourceComponent.
Protected property ConnectionString The connection string
Protected property ContainerErrorCode Read and Write the container error code for this component.
Public property DatabaseCategory Read database category.
Protected property DataReader The SqlDataReader returned by the last SqlCommand execute.
Public property DataSource Gets the name or network address of the instance of SQL Server to connect to.
Protected property DeadlockPause Number of milliseconds to pause before retrying after a deadlock occurs.
Protected property ExecutionTimeThreshold At which time do we trace this call
Public property InitialCatalog Gets the name of the database associated with the component.
Public property IsSqlAzure Returns true if component is used against SQL Azure.
Protected property LoggingOptions Controls whether TIME and IO statistics (or other information message output) should be collected and logged.
Protected property MaxDeadlockRetries Maximum number of times to retry the operation if a deadlock occurs.
Public property PartitionId The id of the partition this component is associated with.
Protected property PerformanceOptions Whether or not to obtain context information, and how much to throttle.
Protected property ProcedureName Name of the procedure currently being executed.
Protected property RequestContext The request context of the current request.
Protected property SelectedFeatures Selected SQL resource component options.
Protected property StatementIndex Index used by the last AddStatement. -1 if AddStatement has not been called.
Protected property TraceArea Can be used in trace definitions to filter tracing to a specific area.
Protected property TranslatedExceptions Requests the set of SqlExceptions that can be translated to local exceptions by using a SqlExceptionFactory.
Public property Version The version of the service's schema

Top

Methods

  Name Description
Protected method AddStatement(String) Add a statement to the current SQL batch. You must call PrepareSqlBatch before you call AddStatement.
Protected method AddStatement(String, Int32) Add a statement to the current SQL batch. You must call PrepareSqlBatch before you call AddStatement. If the number of parameters that will be added by using this statement will exceed the maximum number of allowed parameters in a single SQL batch, the statements that are already part of the batch will be executed, and then a new batch will begin with the statement that's being added.
Protected method AddStatement(String, Int32, Boolean) Add a statement to the current SQL batch. You must call PrepareSqlBatch before you call AddStatement. If the number of parameters that will be added by using this statement will exceed the maximum number of allowed parameters in a single SQL batch, the statements that are already part of the batch will be executed, and then a new batch will begin with the statement that's being added.
Protected method AddStatement(String, Int32, Boolean, Boolean) Add a statement to the current SQL batch. You must call PrepareSqlBatch before you call AddStatement. If the number of parameters that will be added by using this statement will exceed the maximum number of allowed parameters in a single SQL batch, the statements that are already part of the batch will be executed, and then a new batch will begin with the statement that's being added.
Public method BeginTransaction Used to wrap several calls in a single transaction. All executes on this component will be in the transaction until Commit or RollBack are called.
Protected method BindBinary(String, array<Byte[], SqlDbType) This is a helper function that handles binding a binary value to a SqlParameter.
Protected method BindBinary(String, array<Byte[], Int32, SqlDbType) A helper function that handles binding a binary value to a sqlparameter.
Protected method BindBoolean A helper function that handles binding a Boolean or a bit value to a sqlparameter.
Protected method BindByte(String, Byte) A helper function that handles binding an 8-bit value to its sqlparameters.
Protected method BindByte(String, Byte, Byte) A helper function that handles binding an 8-bit value that might be null to its sqlparameters.
Protected method BindDateTime A helper function that handles binding a date/time value to a sqlparameter.
Protected method BindDefault A helper function that handles binding a value to default type.
Protected method BindDouble This is a helper function that takes care of binding 32 bit value to their sqlparameters.
Protected method BindGuid This is a helper function that handles binding GUIDs to their sqlparameters.
Protected method BindInt A helper function that handles binding a 32-bit value to its sqlparameters.
Protected method BindLong A helper function that handles binding a 64-bit value to its sqlparameters.
Protected method BindNullableBoolean This is a helper function that takes care of binding boolean or a bit value to a sqlparameter.
Protected method BindNullableByte This is a helper function that handles binding an 8-bit value to its SqlParameters.
Protected method BindNullableDateTime This is a helper function that takes care of binding a date/time value to a sqlparameter.
Protected method BindNullableGuid A helper function that handles binding GUIDs to their sqlparameters. The value Empty is considered NULL and a NULL is bound to the given parameter.
Protected method BindNullableInt If parameterValue == nullValue, a NULL is bound to the given parameter. Otherwise, parameterValue is bound as a 32-bit integer.
Protected method BindNullableShort If parameterValue == nullValue, a NULL is bound to the given parameter. Otherwise, parameterValue is bound as a 16-bit integer
Protected method BindNullValue This is a generic binding helper that builds a specific parameter typed null value.
Protected method BindShort This is a helper function that handles binding 16 bit value to their sqlparameters.
Protected method BindString(String, String, Int32, BindStringBehavior, SqlDbType) This is a helper function that handles binding strings to their SqlParameters. It makes sure that null values are correctly handled.
Protected method BindString(String, String, Int32, Boolean, SqlDbType) This is a helper function that handles binding strings to their SqlParameters.It makes sure that null values are correctly handled. This is the old version of this method; use the overload that takes a BindStringBehavior to be more explicit about how null and empty strings are to be handled.
Protected method BindSysname A helper function that handles binding sysname strings to their sqlparameters. It makes sure null values are correctly set up.
Protected method BindTable<T> Binds a table.
Protected method BindVariant
Protected method BindXml(String, TeamFoundationDatabaseXmlWriter) Used to bind an XML document to an XML parameter.
Protected method BindXml(String, String) Used to bind an XML document to an XML parameter.
Public method Cancel
Protected method CanRetryOnException Indicates whether the SQL exception can be retried.
Protected method CanRetryOnSqlError
Public method CommitTransaction Commit the transaction that is active for this component.
Public method Dispose
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method Execute Internal helper that encapsulates the logic for ExecuteReader and ExecuteNonQuery.
Protected method ExecuteNonQuery() Executes the current SQL command and does not produce a result set.
Protected method ExecuteNonQuery(Boolean) Executes the current SQL command and does not produce a result set. The only result is the Return Value, which is a single scalar value.
Protected method ExecuteReader() Overload using default command behavior.
Protected method ExecuteReader(CommandBehavior) Executes the current SQL command and returns a reader.
Protected method ExecuteScalar Execute the current SQL command by using ExecuteScalar and stores the result.
Protected method ExecuteUnknown(Object) Executes the current SQL command by using ExecuteUnknown() and returns the object.
Protected method ExecuteUnknown(SqlDataReader, Object) The method that is used by ExecuteUnknown() to populate an object based on a reader caller of ExecuteUnknown must override this method.
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Protected method FlushBatch Flushes the batch that is pended to this point and creates a new batch so that users may call AddStatement again.
Public method GetHashCode Serves as the default hash function. (Inherited from Object.)
Protected method GetParameterName Helper method to format a parameter name.
Protected method GetSqlErrorNumberAsString Helper that returns all the error numbers in a string for tracing purposes It's not super efficient but should only be called in case SQL is having issues which *should* be rare.
Protected method GetSqlErrorNumbers Helper that returns all the error numbers contained in a sql exception object
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method HandleCustomException Handle custom exceptions.
Protected method HandleException Determine whether the SQL exception can be handled; SQL exceptions that cannot be retried or mapped are "unhandled."
Protected method Initialize(String) Initializes a component.
Protected method Initialize(TeamFoundationRequestContext, String, Int32)
Protected method Initialize(String, Int32, Int32, Int32, Int32) Initializes a component.
Protected method MapException(SqlException) Map a SQL exception into an application-specific exception, if it is possible. Otherwise, the exception is reported using Watson.
Protected method MapException(SqlException, QueryExecutionState) Map a SQL exception into an application-specific exception, if it is possible. Otherwise, the exception is reported using Watson.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Protected method PrepareConnectionString Allows derived classes to update connection string.
Protected method PrepareSqlBatch(Int32) Setup to execute a batch of SQL statements. This method will close all existing commands or readers.
Protected method PrepareSqlBatch(Int32, Boolean) Setup to execute a batch of SQL statements. This method will close all existing command or reader.
Protected method PrepareStoredProcedure(String) Setup to execute a SQL stored procedure. This method will close all existing commands or readers.
Protected method PrepareStoredProcedure(String, Boolean) Setup to execute a SQL Server stored procedure. This method will close all existing command or reader.
Protected method PrepareStoredProcedure(String, Int32) Setup to execute a SQL stored procedure. This method will close all existing commands or readers.
Protected method PrepareStoredProcedure(String, Boolean, Int32) Setup to execute a SQL Server stored procedure. This method will close all existing command or reader.
Protected method ReleaseVerificationLock
Public method RollbackTransaction Roll back and discard all changes that were made during the transaction on this component.
Protected method Sleep
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Protected method Trace(Int32, TraceLevel, String, array<Object[]) Push trace messages to the trace service associated with the request context.
Protected method Trace(Int32, TraceLevel, array<String[], String, array<Object[]) Push trace messages to the trace service associated with the request context.
Protected method TraceEnter Trace entry to a method with a consistently formatted message and a time stamp.
Protected method TraceException Report an exception at TraceLevel.Error to the trace log in a consistent way.
Protected method TraceLeave Trace exit from a method with a consistently formatted message and a time stamp.
Protected method TranslateException Examines a SQL Type Exception and transforms it into a more significant one.The default behavior is to do nothing; that is, it is to rethrow the original exception.WIT is the only component that currently overrides the current behavior.
Public methodStatic member TranslateSqlException Not all TFS services use TeamFoundationSqlResourceComponent, but most want to use the common error handling that it contains. Therefore, a static TranslateSqlException can be used externally from the component.
Protected method VerifyInitialized Throws an InvalidOperationException if the component is not initialized.
Protected method VerifyInMasterDbOnAzure Throws InvalidOperationException if components is used against SQL Azure and the Initial Catalog in the connection string is not master or empty.
Protected method VerifyNotSqlAzure Throws NotSupportedException if components are used against SQL Azure.
Public method VerifyServiceVersion(String, Int32, Int32%, Int32%) Connects to the database, takes a shared session lock on the TfsDb resource and verifies that the database supports specified service version.NOTE: This method will be re-written. We must query CONTEXT_INFO(), take a shared lock and query database service version using one query. In addition, we must make sure that the database still supports current component in case we lost connection to the database.
Public method VerifyServiceVersion(String, Int32, Int32%, Int32%, Boolean) This method connects to the database, takes a shared or exclusive session lock on the TfsDb resource and verifies that the database supports specified service version. NOTE: This method will be re-written. We must query CONTEXT_INFO(), take a shared lock and query database service version using one query. In addition, we must ensure that the database still supports current component in case we lost connection to the database.

Top

Events

  Name Description
Public event InfoMessage Exposes the internal InfoMessage event of the SqlConnection. Occurs when SQL Server returns a warning or informational message.

Top

Fields

  Name Description
Public fieldStatic member DatabaseTypeAccount
Public fieldStatic member DatabaseTypeApplication
Public fieldStatic member DatabaseTypeCollection
Public fieldStatic member DatabaseTypeConfiguration
Public fieldStatic member DatabaseTypeWarehouse
Public fieldStatic member ExtendedPropertyCategories Strings that define the instance and schema version extended properties.
Public fieldStatic member ExtendedPropertyConfigurationInProgressStamp
Public fieldStatic member ExtendedPropertyDatabaseType Describes what this database is used for.
Public fieldStatic member ExtendedPropertyDeploymentTypeStamp
Public fieldStatic member ExtendedPropertyFinalConfigurationServiceLevelStamp
Public fieldStatic member ExtendedPropertyHostDeletedInfo
Public fieldStatic member ExtendedPropertyInstanceStamp Obsolete.
Public fieldStatic member ExtendedPropertyNonFrameworkInstanceStamp
Public fieldStatic member ExtendedPropertyProductVersionStamp
Public fieldStatic member ExtendedPropertyReleaseDescriptionStamp
Public fieldStatic member ExtendedPropertyRemoveStepsSucceededStamp
Public fieldStatic member ExtendedPropertySchemaVersion
Public fieldStatic member ExtendedPropertyServiceLevelStamp
Public fieldStatic member ExtendedPropertyServiceLevelToStamp
Public fieldStatic member MaxStatementLengthEstimate When preparing SQL batches, a length estimate is passed in. This caps the maximum size for the estimate.
Public fieldStatic member SchemaVersion Current schema version for the Team Foundation database.
Public fieldStatic member SqlMaxBatchParameters The maximum number of [SqlParameters] that can be bound to a single batch.The SQL Server hard limit is 2100, ADO.NET uses 2 for the sp_executesql call-batch text and parameter list.

Top

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.TeamFoundation.Framework.Server Namespace