Table of Contents

Class SqlServerTools

Namespace
LinqToDB.DataProvider.SqlServer
Assembly
linq2db.dll
public static class SqlServerTools
Inheritance
SqlServerTools

Properties

DefaultBulkCopyType

[Obsolete("Use SqlServerOptions.Default.BulkCopyType instead.")]
public static BulkCopyType DefaultBulkCopyType { get; set; }

Property Value

BulkCopyType

Methods

AsSqlServer<TSource>(ITable<TSource>)

[Sql.QueryExtension(null, Sql.QueryExtensionScope.None, typeof(NoneExtensionBuilder))]
public static ISqlServerSpecificTable<TSource> AsSqlServer<TSource>(this ITable<TSource> table) where TSource : notnull

Parameters

table ITable<TSource>

Returns

ISqlServerSpecificTable<TSource>

Type Parameters

TSource

AsSqlServer<TSource>(IQueryable<TSource>)

[Sql.QueryExtension(null, Sql.QueryExtensionScope.None, typeof(NoneExtensionBuilder))]
public static ISqlServerSpecificQueryable<TSource> AsSqlServer<TSource>(this IQueryable<TSource> source) where TSource : notnull

Parameters

source IQueryable<TSource>

Returns

ISqlServerSpecificQueryable<TSource>

Type Parameters

TSource

CreateDataConnection(DbConnection, SqlServerVersion, SqlServerProvider)

public static DataConnection CreateDataConnection(DbConnection connection, SqlServerVersion version = SqlServerVersion.AutoDetect, SqlServerProvider provider = SqlServerProvider.AutoDetect)

Parameters

connection DbConnection
version SqlServerVersion
provider SqlServerProvider

Returns

DataConnection

CreateDataConnection(DbTransaction, SqlServerVersion, SqlServerProvider)

public static DataConnection CreateDataConnection(DbTransaction transaction, SqlServerVersion version = SqlServerVersion.AutoDetect, SqlServerProvider provider = SqlServerProvider.AutoDetect)

Parameters

transaction DbTransaction
version SqlServerVersion
provider SqlServerProvider

Returns

DataConnection

CreateDataConnection(string, SqlServerVersion, SqlServerProvider)

public static DataConnection CreateDataConnection(string connectionString, SqlServerVersion version = SqlServerVersion.AutoDetect, SqlServerProvider provider = SqlServerProvider.AutoDetect)

Parameters

connectionString string
version SqlServerVersion
provider SqlServerProvider

Returns

DataConnection

DetectServerVersion(SqlServerProvider, string)

Connects to SQL Server Database and parses version information.

public static SqlServerVersion? DetectServerVersion(SqlServerProvider provider, string connectionString)

Parameters

provider SqlServerProvider
connectionString string

Returns

SqlServerVersion?

Detected SQL Server version.

GetDataProvider(SqlServerVersion, SqlServerProvider, string?)

public static IDataProvider GetDataProvider(SqlServerVersion version = SqlServerVersion.AutoDetect, SqlServerProvider provider = SqlServerProvider.AutoDetect, string? connectionString = null)

Parameters

version SqlServerVersion
provider SqlServerProvider
connectionString string

Returns

IDataProvider

QuoteIdentifier(string)

public static string QuoteIdentifier(string identifier)

Parameters

identifier string

Returns

string

ResolveSqlTypes(Assembly)

Registers spatial types assembly (Microsoft.SqlServer.Types). Also check https://linq2db.github.io/articles/FAQ.html#how-can-i-use-sql-server-spatial-types for additional required configuration steps.

public static void ResolveSqlTypes(Assembly assembly)

Parameters

assembly Assembly

ResolveSqlTypes(string)

Tries to load and register spatial types using provided path to types assembly (Microsoft.SqlServer.Types). Also check https://linq2db.github.io/articles/FAQ.html#how-can-i-use-sql-server-spatial-types for additional required configuration steps.

public static void ResolveSqlTypes(string path)

Parameters

path string