C# Class ZocBuild.Database.ScriptRepositories.FileSystemScriptRepository

Represents a script repository that stores build scripts at a location on disk.
This repository requires a specific directory structure. The root location must contain subdirectories for each database schema, each named with the name of the schema. Within those directories should be a directory for each database object type: Function, Procedure, Type, View. Within those directories should be the build scripts, with file names ending with ".sql". The name of each file should be the same name as the database object it creates.
Inheritance: IScriptRepository
Datei anzeigen Open project: Zocdoc/ZocBuild.Database Class Usage Examples

Protected Properties

Property Type Description
FileSystem IFileSystem
IsFileInSupportedDirectory bool>.Func
Logger ILogger

Public Methods

Method Description
FileSystemScriptRepository ( DirectoryInfoBase scriptDirectory, string serverName, string databaseName, IFileSystem fileSystem, IParser sqlParser, ILogger logger, bool ignoreUnsupportedSubdirectories ) : System

Instantiates a file system repository for the given database at the specified directory location.

FileSystemScriptRepository ( string scriptDirectoryPath, string serverName, string databaseName, IFileSystem fileSystem, IParser sqlParser, ILogger logger, bool ignoreUnsupportedSubdirectories ) : System

Instantiates a file system repository for the given database at the specified directory location.

GetAllScriptsAsync ( ) : Task>

Gets all the build scripts for database objects contained in the repository.

GetChangedScriptsAsync ( ) : Task>

This method is not supported and calling it will raise a NotSupportedException.

GetScriptAsync ( TypedDatabaseObject dbObject ) : Task

Retrieves the build script corresponding to the given database object identifier.

GetScriptFile ( TypedDatabaseObject dbObject ) : System.IO.Abstractions.FileInfoBase

Retrieves the script file for the given database object identifier, if and only if the database object belongs to this script repository.

Protected Methods

Method Description
GetScriptAsync ( System.IO.Abstractions.FileInfoBase file ) : Task

Retrieves the build script contained in the given file.

GetScriptsAsync ( ) : Task>

Gets the build scripts in the repository that satisfy the given predicate.

Private Methods

Method Description
GetDropScript ( TypedDatabaseObject dbObject ) : string

Method Details

FileSystemScriptRepository() public method

Instantiates a file system repository for the given database at the specified directory location.
public FileSystemScriptRepository ( DirectoryInfoBase scriptDirectory, string serverName, string databaseName, IFileSystem fileSystem, IParser sqlParser, ILogger logger, bool ignoreUnsupportedSubdirectories ) : System
scriptDirectory System.IO.Abstractions.DirectoryInfoBase The directory where build scripts are located.
serverName string The name of the database server.
databaseName string The name of the database.
fileSystem IFileSystem An object that provides access to the file system.
sqlParser IParser The sql script parser for reading the SQL file contents.
logger ILogger A Logger
ignoreUnsupportedSubdirectories bool A flag indicating whether to ignore subdirectories that don't conform to the expected naming convention.
return System

FileSystemScriptRepository() public method

Instantiates a file system repository for the given database at the specified directory location.
public FileSystemScriptRepository ( string scriptDirectoryPath, string serverName, string databaseName, IFileSystem fileSystem, IParser sqlParser, ILogger logger, bool ignoreUnsupportedSubdirectories ) : System
scriptDirectoryPath string The path to the directory where build scripts are located.
serverName string The name of the database server.
databaseName string The name of the database.
fileSystem IFileSystem An object that provides access to the file system.
sqlParser IParser The sql script parser for reading the SQL file contents.
logger ILogger A Logger
ignoreUnsupportedSubdirectories bool A flag indicating whether to ignore subdirectories that don't conform to the expected naming convention.
return System

GetAllScriptsAsync() public method

Gets all the build scripts for database objects contained in the repository.
public GetAllScriptsAsync ( ) : Task>
return Task>

GetChangedScriptsAsync() public method

This method is not supported and calling it will raise a NotSupportedException.
public GetChangedScriptsAsync ( ) : Task>
return Task>

GetScriptAsync() protected method

Retrieves the build script contained in the given file.
protected GetScriptAsync ( System.IO.Abstractions.FileInfoBase file ) : Task
file System.IO.Abstractions.FileInfoBase The file containing a build script
return Task

GetScriptAsync() public method

Retrieves the build script corresponding to the given database object identifier.
public GetScriptAsync ( TypedDatabaseObject dbObject ) : Task
dbObject TypedDatabaseObject The database object for which a build script is desired.
return Task

GetScriptFile() public method

Retrieves the script file for the given database object identifier, if and only if the database object belongs to this script repository.
public GetScriptFile ( TypedDatabaseObject dbObject ) : System.IO.Abstractions.FileInfoBase
dbObject TypedDatabaseObject The database object for which a script file is desired.
return System.IO.Abstractions.FileInfoBase

GetScriptsAsync() protected method

Gets the build scripts in the repository that satisfy the given predicate.
protected GetScriptsAsync ( ) : Task>
return Task>

Property Details

FileSystem protected_oe property

The contract for interacting with the file system.
protected IFileSystem FileSystem
return IFileSystem

IsFileInSupportedDirectory protected_oe property

A function that indicates whether a given file is in a managed directory.
protected Func IsFileInSupportedDirectory
return bool>.Func

Logger protected_oe property

A Logger
protected ILogger Logger
return ILogger