SqlProviderServices Class

Definition

The DbProviderServices implementation for the SqlClient provider for SQL Server.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")]
public sealed class SqlProviderServices : System.Data.Entity.Core.Common.DbProviderServices
type SqlProviderServices = class
    inherit DbProviderServices
Public NotInheritable Class SqlProviderServices
Inherits DbProviderServices
Inheritance
SqlProviderServices
Attributes

Remarks

Note that instance of this type also resolve additional provider services for Microsoft SQL Server when this type is registered as an EF provider either using an entry in the application's config file or through code-based registration in DbConfiguration. The services resolved are: Requests for IDbConnectionFactory are resolved to a Singleton instance of SqlConnectionFactory to create connections to SQL Express by default. Requests for Func<TResult> for the invariant name "System.Data.SqlClient" for any server name are resolved to a delegate that returns a System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy to provide a non-retrying policy for SQL Server. Requests for MigrationSqlGenerator for the invariant name "System.Data.SqlClient" are resolved to SqlServerMigrationSqlGenerator instances to provide default Migrations SQL generation for SQL Server. Requests for DbSpatialServices for the invariant name "System.Data.SqlClient" are resolved to a Singleton instance of SqlSpatialServices to provide default spatial services for SQL Server.

Fields

ProviderInvariantName

This is the well-known string using in configuration files and code-based configuration as the "provider invariant name" used to specify Microsoft SQL Server for ADO.NET and Entity Framework provider services.

Properties

Instance

The Singleton instance of the SqlProviderServices type.

SqlServerTypesAssemblyName

Set to the full name of the Microsoft.SqlServer.Types assembly to override the default selection

TruncateDecimalsToScale

Get or sets a value indicating whether Decimal parameter values are truncated to the scale (number of decimal places) defined for their corresponding columns when they are sent to the database. A value of true indicates that SqlParameter objects created for Decimal columns will have their Scale properties set, which will cause the parameter values to be truncated. If set to false then the Scale properties will not be set, avoiding the truncation behavior of SqlParameter and allowing SQL Server to round values if necessary. The default value is true to prevent breaking existing applications that depend on this behavior.

UseRowNumberOrderingInOffsetQueries

Gets or sets a value indicating whether the ROW_NUMBER() function is used in sort expression passed to the ORDER BY clause when OFFSET is present in query. The default value of true is recommended to obtain query results that are stable for paging operations. The value of false can be used for compatibility with previous versions of EF and will cause the sort expression to be passed unmodified to the ORDER BY clause, which can lead to unstable results if the ordering is ambiguous.

UseScopeIdentity

Gets or sets a value indicating whether to use the SCOPE_IDENTITY() function to retrieve values generated by the database for numeric columns during an INSERT operation. The default value of true is recommended and can provide better performance if all numeric values are generated using IDENTITY columns. If set to false, an OUTPUT clause will be used instead. An OUTPUT clause makes it possible to retrieve values generated by sequences or other means.

Methods

AddDependencyResolver(IDbDependencyResolver)

Adds an IDbDependencyResolver that will be used to resolve additional default provider services when a derived type is registered as an EF provider either using an entry in the application's config file or through code-based registration in DbConfiguration.

(Inherited from DbProviderServices)
CloneDbCommand(DbCommand)

See issue 2390 - cloning the DesignTimeVisible property on the DbCommand can cause deadlocks. So here allow sub-classes to override.

(Inherited from DbProviderServices)
CloneDbConnection(DbConnection)

Clones the connection.

(Inherited from DbProviderServices)
CloneDbConnection(DbConnection, DbProviderFactory)

Clones the connection.

CreateCommandDefinition(DbCommand)

Create the default DbCommandDefinition object based on the prototype command This method is intended for provider writers to build a default command definition from a command. Note: This will clone the prototype

(Inherited from DbProviderServices)
CreateCommandDefinition(DbCommandTree)

Create a Command Definition object given a command tree.

(Inherited from DbProviderServices)
CreateCommandDefinition(DbProviderManifest, DbCommandTree)

Creates command definition from specified manifest and command tree.

(Inherited from DbProviderServices)
CreateDatabase(DbConnection, Nullable<Int32>, StoreItemCollection)

Creates a database indicated by connection and creates schema objects (tables, primary keys, foreign keys) based on the contents of storeItemCollection.

(Inherited from DbProviderServices)
CreateDatabaseScript(String, StoreItemCollection)

Generates a data definition language (DDL script that creates schema objects (tables, primary keys, foreign keys) based on the contents of the StoreItemCollection parameter and targeted for the version of the database corresponding to the provider manifest token.

(Inherited from DbProviderServices)
CreateDbCommandDefinition(DbProviderManifest, DbCommandTree)

Creates a command definition object for the specified provider manifest and command tree.

(Inherited from DbProviderServices)
DatabaseExists(DbConnection, Nullable<Int32>, Lazy<StoreItemCollection>)

Returns a value indicating whether a given database exists on the server.

(Inherited from DbProviderServices)
DatabaseExists(DbConnection, Nullable<Int32>, StoreItemCollection)

Returns a value indicating whether a given database exists on the server.

(Inherited from DbProviderServices)
DbCreateDatabase(DbConnection, Nullable<Int32>, StoreItemCollection)

Creates a database indicated by connection and creates schema objects (tables, primary keys, foreign keys) based on the contents of a StoreItemCollection.

(Inherited from DbProviderServices)
DbCreateDatabaseScript(String, StoreItemCollection)

Generates a data definition language (DDL) script that creates schema objects (tables, primary keys, foreign keys) based on the contents of the StoreItemCollection parameter and targeted for the version of the database corresponding to the provider manifest token.

(Inherited from DbProviderServices)
DbDatabaseExists(DbConnection, Nullable<Int32>, Lazy<StoreItemCollection>)

Returns a value indicating whether a given database exists on the server.

(Inherited from DbProviderServices)
DbDatabaseExists(DbConnection, Nullable<Int32>, StoreItemCollection)

Returns a value indicating whether a given database exists on the server.

(Inherited from DbProviderServices)
DbDeleteDatabase(DbConnection, Nullable<Int32>, StoreItemCollection)

Deletes the specified database.

(Inherited from DbProviderServices)
DbGetSpatialServices(String)
Obsolete.

Gets the spatial services for the DbProviderServices.

(Inherited from DbProviderServices)
DeleteDatabase(DbConnection, Nullable<Int32>, StoreItemCollection)

Deletes the specified database.

(Inherited from DbProviderServices)
GetDbProviderManifest(String)

When overridden in a derived class, returns an instance of a class that derives from the DbProviderManifest.

(Inherited from DbProviderServices)
GetDbProviderManifestToken(DbConnection)

Returns provider manifest token for a given connection.

(Inherited from DbProviderServices)
GetDbSpatialDataReader(DbDataReader, String)

Gets the spatial data reader for the DbProviderServices.

(Inherited from DbProviderServices)
GetProviderManifest(String)

Returns the provider manifest by using the specified version information.

(Inherited from DbProviderServices)
GetProviderManifestToken(DbConnection)

Returns provider manifest token given a connection.

(Inherited from DbProviderServices)
GetService(Type, Object)

Called to resolve additional default provider services when a derived type is registered as an EF provider either using an entry in the application's config file or through code-based registration in DbConfiguration. The implementation of this method in this class uses the resolvers added with the AddDependencyResolver method to resolve dependencies.

(Inherited from DbProviderServices)
GetServices(Type, Object)

Called to resolve additional default provider services when a derived type is registered as an EF provider either using an entry in the application's config file or through code-based registration in DbConfiguration. The implementation of this method in this class uses the resolvers added with the AddDependencyResolver method to resolve dependencies.

(Inherited from DbProviderServices)
GetSpatialDataReader(DbDataReader, String)

Gets the spatial data reader for the DbProviderServices.

(Inherited from DbProviderServices)
GetSpatialServices(DbProviderInfo)

Gets the spatial services for the DbProviderServices.

(Inherited from DbProviderServices)
GetSpatialServices(String)
Obsolete.

Gets the spatial services for the DbProviderServices.

(Inherited from DbProviderServices)
RegisterInfoMessageHandler(DbConnection, Action<String>)

Registers a handler to process non-error messages coming from the database provider.

SetDbParameterValue(DbParameter, TypeUsage, Object)

Sets the parameter value and appropriate facets for the given TypeUsage.

(Inherited from DbProviderServices)
SetParameterValue(DbParameter, TypeUsage, Object)

Sets the parameter value and appropriate facets for the given TypeUsage.

(Inherited from DbProviderServices)

Extension Methods

GetService(IDbDependencyResolver, Type)

Calls GetService(Type, Object) passing the given type argument and using null for the name argument.

GetService<T>(IDbDependencyResolver)

Calls GetService(Type, Object) passing the generic type of the method as the type argument and null for the name argument.

GetService<T>(IDbDependencyResolver, Object)

Calls GetService(Type, Object) passing the generic type of the method and the given name as arguments.

GetServices(IDbDependencyResolver, Type)

Calls GetServices(Type, Object) passing the given type argument and using null for the name argument.

GetServices<T>(IDbDependencyResolver)

Calls GetServices(Type, Object) passing the generic type of the method as the type argument and null for the name argument.

GetServices<T>(IDbDependencyResolver, Object)

Calls GetServices(Type, Object) passing the generic type of the method and the given name as arguments.

Applies to