<commit_before># Cake.SqlServer
 
Cake Build addin for working with SqlServer and LocalDb.

Show me the codez: [integration tests](https://github.com/AMVSoftware/Cake.SqlServer/blob/master/tests.cake) for live up to date examples.  
Or look through XML-generated documentation on [Cakebuild.net site](http://cakebuild.net/dsl/sqlserver/).

# General Functionality

### Create Database
```c#
CreateDatabase(string connectionString, string databaseName)
```
Creates database. If database with this name exists - SqlException is thrown. 

### Create Database If Not Exist
```c#
CreateDatabaseIfNotExists(string connectionString, string databaseName)
```

Here we check if the database exists first, if it does not exists - create it. Does not do anything if database with this name already exists.


### Drop Database
```c#
DropDatabase(string connectionString, string databaseName)
```

Basically executes `Drop Database databasename` with some fail-safes. Actually it sets the database into offline mode - to cut off all existing connections. Then sets the database back online and then drops it. 
Reason for this dance - you can't drop a database if there are existing connections to the database.  

### Drop and Create Database<commit_msg>Added index on Readme.md<commit_after># Cake.SqlServer
 
Cake Build addin for working with SqlServer and LocalDb.

Show me the codez: [integration tests](https://github.com/AMVSoftware/Cake.SqlServer/blob/master/tests.cake) for live up to date examples.  
Or look through XML-generated documentation on [Cakebuild.net site](http://cakebuild.net/dsl/sqlserver/).

* [General Functionality](#general-functionality)
* [Working With Backup files](#working-with-backup-files)
* [Working with BACPAC and DACPAC](#working-with-bacpac-and-dacpac)
* [Working with LocalDB](#working-with-localdb)
* [Usage](#usage)
* [Reason to Develop](#reason-to-develop)


# General Functionality

### Create Database
```c#
CreateDatabase(string connectionString, string databaseName)
```
Creates database. If database with this name exists - SqlException is thrown. 

### Create Database If Not Exist
```c#
CreateDatabaseIfNotExists(string connectionString, string databaseName)
```

Here we check if the database exists first, if it does not exists - create it. Does not do anything if database with this name already exists.


### Drop Database
```c#
DropDatabase(string connectionString, string databaseName)
```

Basically executes `Drop Database databasename` with some fail-safes. Actually it sets the database into offline mode - to cut off all existing connections. Then sets the database back online and then drops it. 
Reason for this dance - you can't drop a database if there are existing connections to the database.  

### Drop and Create Database
{'fraction_non_alphanumeric': 0.08744152572867939, 'fraction_numerical': 0.0, 'mean_word_length': 5.004319654427646, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '32505', 'n_tokens_mistral': 773, 'n_tokens_neox': 722, 'n_words': 314}