Namespaces

Types in Fake.SQL

Type SqlServer

Namespace Fake.SQL

Methods

Public static methods

ServerInfo Attach(ServerInfo serverInfo, AttachOptions attachOptions, IEnumerable<string> files)

ServerInfo CreateDb(ServerInfo serverInfo)

ServerInfo Detach(ServerInfo serverInfo)

void Disconnect(ServerInfo serverInfo)

void DropAndCreateDatabase(string connectionString)

Drops and creates the database (dropped if db exists. created nonetheless)
Parameters
string connectionString

Used to open the connection to the database.

ServerInfo DropDb(ServerInfo serverInfo)

bool existDBOnServer(ServerInfo serverInfo, string dbName)

Database getDatabase(ServerInfo serverInfo)

IEnumerable<string> getDatabaseNamesFromServer(ServerInfo serverInfo)

IEnumerable<Database> getDatabasesFromServer(ServerInfo serverInfo)

string getDBName(ServerInfo serverInfo)

ServerInfo getServerInfo(string connectionString)

Gets a connection to the SQL server and an instance to the ConnectionStringBuilder

string getServerName(ServerInfo serverInfo)

bool intitialCatalogExistsOnServer(ServerInfo serverInfo)

ServerInfo KillAllProcesses(ServerInfo serverInfo)

void ReplaceDatabaseFiles(string connectionString, string targetDir, IEnumerable<string> files, AttachOptions attachOptions)

Replaces the database files

void ReplaceDatabaseFilesWithCache(string connectionString, string targetDir, string cacheDir, IEnumerable<string> files, AttachOptions attachOptions)

Replaces the database files from a cache. If the files in the cache are not up to date, they will be refreshed.
Parameters
string connectionString

Used to open the connection to the database.

string targetDir

The directory where the attached files will live.

string cacheDir

The file cache. If the files in the cache are not up to date, they will be refreshed.

IEnumerable<string> files

The original database files.

AttachOptions attachOptions

AttachOptions for Sql server.

void runScript(ServerInfo serverInfo, string sqlFile)

void RunScripts(string connectionString, IEnumerable<string> scripts)

Runs the given sql scripts on the server.
Parameters
string connectionString

Used to open the connection to the database.

IEnumerable<string> scripts

The scripts which will be run.

void RunScriptsFromDirectory(string connectionString, string scriptDirectory)

Runs all sql scripts from the given directory on the server.
Parameters
string connectionString

Used to open the connection to the database.

string scriptDirectory

All *.sql files inside this directory and all subdirectories will be run.