-
Notifications
You must be signed in to change notification settings - Fork 1
Home
- FileTableQueryProvider
- IFileTableQueryProvider
- Resources
- SqlContext
- SqlDirectory
- SqlDirectoryInfo
-
SqlFile
- WindowsEncoding
- Create(path)
- Move(sourcePath,destinationPath)
- ReadAllBytes(sqlFileInfo)
- ReadAllBytes(sqlFileInfo)
- ReadAllBytes(sqlFileInfo)
- ReadAllBytes(sqlFileInfo,encoding)
- ReadAllLines(sqlFileInfo)
- ReadAllLines(sqlFileInfo)
- ReadAllText(sqlFileInfo)
- ReadAllText(sqlFileInfo)
- WriteAllBytes(sqlFileInfo,value)
- WriteAllBytes(sqlFileInfo,value)
- WriteAllBytes(sqlFileInfo,value)
- WriteAllBytes(sqlFileInfo,value)
- WriteAllLines(sqlFileInfo,value)
- WriteAllLines(sqlFileInfo,value)
- WriteAllText(sqlFileInfo,value)
- WriteAllText(sqlFileInfo,value)
- SqlFileInfo
- SqlFileStream
- SqlFileSystemEntry
- SqlFileSystemInfo
-
SqlFileTable
- #ctor(connectionStringProvider,objectId,enabled,directoryName,tableName)
- Directory_Name
- Is_Enabled
- Object_Id
- Table_Name
- connectionStringProvider
- GetAllEntries()
- GetDirectories()
- GetDirectory(stream_Id)
- GetEntry(path)
- GetFile(stream_Id)
- GetFiles()
- GetSqlFileTable(connectionStringProvider,directoryName)
- GetSqlFileTables(connectionStringProvider)
- SqlFileTableInfo
- SqlLocator
- SqlLocatorId
- SqlPath
- SqlPathInfo
- StreamWrapper
- StringConnectionProvider
Sql.IO
A concret implementation of the IFileTableQueryProvider used to generate Sql required for retrieving SqlFileSystemEntry objects from a SqlFileTable.
SQl needed to execute retrieve directorsy the specified SqlFileTable.
| Name | Type | Description |
|---|---|---|
| table_Name | System.String |
Sql.IO
A SQL generator for retrieving SqlFileSystemEntry objects from a SqlFileTable.
SQl needed to execute retrieve directorsy the specified SqlFileTable.
| Name | Type | Description |
|---|---|---|
| table_Name | System.String |
Sql.IO.Properties
A strongly-typed resource class, for looking up localized strings, etc.
Overrides the current thread's CurrentUICulture property for all resource lookups using this strongly typed resource class.
Looks up a localized string similar to SELECT
{0}
FROM
[{1}]
WHERE [is_directory] =1 and [parent_path_locator].ToString()={2}
.
Returns the cached ResourceManager instance used by this class.
Sql.IO
Represents a database context for connecting to the Sql Datbase where the SqlFileSystemEntry are located
Initalizes a new instance of the SqlContext using the conection string supplied by the IConnectionStringProvider
| Name | Type | Description |
|---|---|---|
| connectionStringProvider | Sql.IO.IConnectionStringProvider |
An instance of the current SqlConnection
A TSQL provider used to format and generate TSQL DDL for database operations.
The connection string for the SqlContext instance;
Returns a list of SqlDirectoryInfo in the spe
| Name | Type | Description |
|---|---|---|
| table_Name | System.String | |
| param | System.Object |
Returns the IConnectionStringProvider used to connext to the datbase containing the SqlFileTable for the specified path.
| Name | Type | Description |
|---|---|---|
| path | System.String | A string containing SqlPathInfo to lookup the IConnectionStringProvider for. |
Returns the IConnectionStringProvider used to connect to the datbase containing the SqlFileTable for the specified path.
| Name | Type | Description |
|---|---|---|
| pahtInfo | Sql.IO.SqlPathInfo | The SqlPathInfo to lookup the IConnectionStringProvider for. |
Development stub for Dependency Injection until an IOC container is chosen.
This method has no parameters.
| Name | Description |
|---|---|
| T |
Executes a query returning the data typed as T.
| Name | Type | Description |
|---|---|---|
| sql | System.String | The SQL to execute for the query. |
| param | System.Object | The parameters to pass, if any. |
| Name | Description |
|---|---|
| T | The type of the results to return. |
Sql.IO
Helper extensions to extend commonly used Directory methods so they can be used with a SqlDirectoryInfo.
Creates a new directory at the specified path and returns a SqlDirectoryInfo for the directory.
| Name | Type | Description |
|---|---|---|
| path | System.String |
Deletes the directory at the specified path. If the directory is not empty an exception is thrown. To delete a directory and all of its contents use the Delete overload.
| Name | Type | Description |
|---|---|---|
| path | System.String | The path of the directory to delete. |
Deletes the directory at the specified path.
| Name | Type | Description |
|---|---|---|
| path | System.String | The path of the directory to delete. |
| recursive | System.Boolean | If set to false and the directory is not empty an exception is thrown. |
| If set to true the directory and all content in the direcrtory and all of its subdirectories are deleted. |
Returns a list of SqlDirectoryInfo located in the specified path.
| Name | Type | Description |
|---|---|---|
| path | System.String | The path to enumerate. |
Returns a list of SqlFileSystemInfo located in the specified path.
| Name | Type | Description |
|---|---|---|
| path | System.String | The path to enumerate. |
Returns a list of SqlFileInfo located in the specified path.
| Name | Type | Description |
|---|---|---|
| path | System.String | The path to enumerate. |
Returns true if a directory exists at the specified path.
| Name | Type | Description |
|---|---|---|
| path | System.String | The path to check. |
Returns the parent of the directory at the specified path.
| Name | Type | Description |
|---|---|---|
| path | System.String | The path to return the parent for. |
Moves a file or a directory and its contents to a new location.
| Name | Type | Description |
|---|---|---|
| srcPath | System.String | The path to the file or directory to be moved. |
| destinationPath | System.String | The path to move the content at the source to. |
| If the source if a file then destinationPath must also be a file name. | ||
| If the source is a directory then destinationPath must also be a directory. |
Sql.IO
Provides DirectoryInfo and FileSystemInfo style functionality for a SqlDirectoryInfo entry in the SqlFileTable.
Initialize a new SqlDirectoryInfo based on the metadata in the specified SqlFileSystemEntry.
| Name | Type | Description |
|---|---|---|
| entry | Sql.IO.SqlFileSystemEntry | The metadata for the SqlDirectoryInfo. |
| connectionStringProvider | Sql.IO.IConnectionStringProvider | A connection string provider for accessing the underlying SqlFileTable for perform IO operations. |
| fileTable | Sql.IO.SqlFileTable | The SqlFileTable for the SqlDirectoryInfo. |
Initializes a new SqlDirectoryInfo based on the specified path.
| Name | Type | Description |
|---|---|---|
| fullPath | System.String | The full path to the directory. |
Cached_File_Size is not implemented for a SqlDirectoryInfo. Throws a NotImplementedException
File Type is not implemented for a SqlDirectoryInfo. Throws a NotImplementedException
A flag indicating the underlying SqlFileSystemInfo is a directory.
The name of the SqlDirectoryInfo.
Creates a new directory.
This method has no parameters.
Gets a list of sub directories that exist in the current directory.
This method has no parameters.
Gets a list of files that exist in the current directory.
This method has no parameters.
Moves the directory and all of its content to the destination path
| Name | Type | Description |
|---|---|---|
| destinationPath | System.String |
Sql.IO
Helper extensions to extend commonly used File methods to a SqlFileInfo's underlying stream
The default Windows-1252 Code Page
Creates a new empty file at the specified locatoin and returns the SqlFileInfo for the file.
| Name | Type | Description |
|---|---|---|
| path | System.String |
Moves a file from the specified source path to the specified destination path
| Name | Type | Description |
|---|---|---|
| sourcePath | System.String | |
| destinationPath | System.String |
Reads the contents of the SqlFileInfo's underlying stream as a byte array using Windows-1252 Encoding.
| Name | Type | Description |
|---|---|---|
| sqlFileInfo | Sql.IO.SqlFileTable |
Reads the contents of the SqlFileInfo's underlying stream as a byte array using Windows-1252 Encoding.
| Name | Type | Description |
|---|---|---|
| sqlFileInfo | Sql.IO.SqlFileInfo |
Reads the contents of the SqlFileInfo's underlying stream as a byte array using Windows-1252 Encoding.
| Name | Type | Description |
|---|---|---|
| sqlFileInfo | Sql.IO.SqlFileTable |
Reads the contents of the SqlFileInfo's underlying stream as a byte array using the specified Encoding.
| Name | Type | Description |
|---|---|---|
| sqlFileInfo | Sql.IO.SqlFileInfo | |
| encoding | System.Text.Encoding |
Reads the contents of the SqlFileInfo as string array.
| Name | Type | Description |
|---|---|---|
| sqlFileInfo | Sql.IO.SqlFileTable |
Reads the contents of the SqlFileInfo as string array.
| Name | Type | Description |
|---|---|---|
| sqlFileInfo | Sql.IO.SqlFileInfo |
Reads the contents of the SqlFileInfo's underlying stream as string.
| Name | Type | Description |
|---|---|---|
| sqlFileInfo | Sql.IO.SqlFileTable |
Reads the contents of the SqlFileInfo's underlying stream as string.
| Name | Type | Description |
|---|---|---|
| sqlFileInfo | Sql.IO.SqlFileInfo |
Writes the specified byte array to the SqlFileInfo's underlying stream using Windows-1252 Encoding. If the file exists, it's content is overwritten.
| Name | Type | Description |
|---|---|---|
| sqlFileInfo | Sql.IO.SqlFileTable | |
| value | System.Guid |
Writes the specified byte array to the SqlFileInfo's underlying stream using Windows-1252 Encoding. If the file exists, it's content is overwritten.
| Name | Type | Description |
|---|---|---|
| sqlFileInfo | Sql.IO.SqlFileInfo | |
| value | System.Byte[] |
Writes the specified byte array to the SqlFileInfo's underlying stream using the specified Encoding. If the file exists, it's content is overwritten.
| Name | Type | Description |
|---|---|---|
| sqlFileInfo | Sql.IO.SqlFileTable | |
| value | System.Guid |
Writes the specified byte array to the SqlFileInfo's underlying stream using the specified Encoding. If the file exists, it's content is overwritten.
| Name | Type | Description |
|---|---|---|
| sqlFileInfo | Sql.IO.SqlFileInfo | |
| value | System.Byte[] |
Writes the specified string array to the SqlFileInfo's underlying stream. If the file exists, it's content is overwritten.
| Name | Type | Description |
|---|---|---|
| sqlFileInfo | Sql.IO.SqlFileTable | |
| value | System.Guid |
Writes the specified string array to the SqlFileInfo's underlying stream. If the file exists, it's content is overwritten.
| Name | Type | Description |
|---|---|---|
| sqlFileInfo | Sql.IO.SqlFileInfo | |
| value | System.String[] |
Writes the specified string to the SqlFileInfo's underlying stream. If the file exists, it's content is overwritten.
| Name | Type | Description |
|---|---|---|
| sqlFileInfo | Sql.IO.SqlFileTable | |
| value | System.Guid |
Writes the specified string to the SqlFileInfo's underlying stream. If the file exists, it's content is overwritten.
| Name | Type | Description |
|---|---|---|
| sqlFileInfo | Sql.IO.SqlFileInfo | |
| value | System.String |
Sql.IO
Provides FileInfo and FileSystemInfo style functionality for a file in the SqlFileTable.
Initialize a new SqlFileInfo based on the metadata in the specified SqlFileSystemEntry.
| Name | Type | Description |
|---|---|---|
| entry | Sql.IO.SqlFileSystemEntry | The metadata for the SqlFileInfo. |
| connectionStringProvider | Sql.IO.IConnectionStringProvider | A connection string provider for accessing the underlying SqlFileTable for perform IO operations. |
| fileTable | Sql.IO.SqlFileTable | The SqlFileTable for the SqlFileInfo. |
Initializes a SqlFileSystemInfo based on the specified path.
| Name | Type | Description |
|---|---|---|
| fullPath | System.String | The full path to the file. |
Flag to indicate the underlying SqlFileSystemInfo is a file and not a directory.
Creates a new file and returns a references to a stream for performing IO operations on the underlying file content.
This method has no parameters.
The SqlFileStream of the actual file content, This value is null for directories or empty for files with no content.
This method has no parameters.
Moves the file to the specified destination path
| Name | Type | Description |
|---|---|---|
| destinationPath | System.String |
Opens overwrites and existing file and return a new stream for performing IO operations on the underlying file content.
This method has no parameters.
Sql.IO
A StreamWrapper to provide functionality to work with a Sql FileStream as if it were a regular FileStream.
Closes the underlying file stream after updating the File's content in the database if has been modified.
This method has no parameters.
Updates the file content in database with the content of the underlying stream.
This method has no parameters.
Sql.IO
Domain object model of SQL FileTable records that provide meta data for SqlFileSystemInfo implementations the SqlFileInfo and SqlDirectoryInfo.
A cache of the Length computed using datalength(file_stream). This value will be when Is_Directory is . There are rare edge cases in which this value could temporarily be out of sync.
A persisted computed column that contains the extension of the file. Calculated using the database function getextension(name). This value will be when the file has no extension or Is_Directory is .
The full path and name of the file or foder. The MaxLengthAttribute is 260.
A flag representing if the Archive attribute is set.
A flag to indicate if the entry is a directory. When the value is the entry is a file.
A flag representing if the Hidden attribute is set.
A flag representing if the Offline attribute is set.
A flag representing if the ReadOnly attribute is set.
A flag representing if the System attribute is set.
A flag representing if the Temporary attribute is set.
Contains the LastAccessTime. This will be until the file is accessed.
Stored in the database with a precion of 34 and scale of 7
Contains the LastWriteTime
Stored in the database with a precion of 34 and scale of 7
The name of the file or folder. The MaxLengthAttribute is 255.
The primary key of the table containing the heirarchyid for the file or folder.
A UniqueIdentifier rowguidcol column for each FILESTREAM in the FILETABLE
Sql.IO
Provides FileSystemInfo style functionality and synchorizes underlying SqlFileSystemEntry metadata.
Initialize a new SqlFileSystemInfo based on the metadata in the specified SqlFileSystemEntry.
| Name | Type | Description |
|---|---|---|
| entry | Sql.IO.SqlFileSystemEntry | The metadata for the SqlFileSystemInfo. |
| connectionStringProvider | Sql.IO.IConnectionStringProvider | A connection string provider for accessing the underlying SqlFileTable for perform IO operations. |
| fileTable | Sql.IO.SqlFileTable | The SqlFileTable for the SqlDirectoryInfo. |
Initializes a new SqlFileSystemInfo based on the specified path.
| Name | Type | Description |
|---|---|---|
| fullPath | System.String | The full path to the directory. |
A cache of the Length computed using datalength(file_stream). This value will be when Is_Directory is . There are rare edge cases in which this value could temporarily be out of sync.
Returns the parent SqlDirectoryInfo for this SqlFileSystemInfo.
Returns true if this SqlFileSystemInfo exists by determining if there is a corresponding SqlFileSystemEntry in the underlying SqlFileTable.
A persisted computed column that contains the extension of the file. Calculated using the database function getextension(name). This value will be when the file has no extension or Is_Directory is .
The full path and name of the file or foder. The MaxLengthAttribute is 260.
A flag representing if the Archive attribute is set.
A flag to indicate if the entry is a directory. When the value is the entry is a file.
A flag representing if the Hidden attribute is set.
A flag representing if the Offline attribute is set.
A flag representing if the ReadOnly attribute is set.
A flag representing if the System attribute is set.
A flag representing if the Temporary attribute is set.
Contains the LastAccessTime. This will be until the file is accessed.
Stored in the database with a precion of 34 and scale of 7
Contains the LastWriteTime
Stored in the database with a precion of 34 and scale of 7
The name of the file or folder. The MaxLengthAttribute is 255.
The primary key of the table containing the heirarchyid for the file or folder.
A UniqueIdentifier rowguidcol column for each FILESTREAM in the FILETABLE
Deletes this SqlFileSystemInfo from the underlying SqlFileTable which triggers a physical deletion from disk. If entry is a SqlDirectoryInfo and it is not empty an exception is thrown. To delete a directory and all of its contents use Delete
This method has no parameters.
Deletes this SqlFileSystemInfo from the underlying SqlFileTable which triggers a physical deletion from disk. If the directory is not empty an exception is thrown
This method has no parameters.
Synchorized data with the specified SqlFileSystemEntry.
| Name | Type | Description |
|---|---|---|
| dbEntry | Sql.IO.SqlFileSystemEntry |
Sql.IO
A class providing style functionality to directories and files saved in a Sql File Table.
Initializes a new SqlFileTables to provide services for accessing SqlFileSystemInfo meta data defined in the File Table.
| Name | Type | Description |
|---|---|---|
| connectionStringProvider | Sql.IO.IConnectionStringProvider | |
| objectId | System.Int64 | |
| enabled | System.Boolean | |
| directoryName | System.String | |
| tableName | System.String |
The name of the directory where the contents of the SqlFileTable file exists on disk.
A flag indicating if the SqlFileTable is enabled.
The native object_id for the SqlFileTable in the Sql Server.
Then Sql table name of the SqlFileTable in the Sql Server database.
A provider to supply connection string information to the server and database where the SqlFileTable exists.
Returns metadata for every SqlFileSystemEntry row in the SqlFileTable.
This method has no parameters.
Returns a list of all SqlDirectoryInfo that exist in the root of the SqlFileTable. This method provides the functionality similar to GetDirectories.
This method has no parameters.
Retrieves a SqlDirectoryInfo from the SqlFileTable based on its stream_Id.
If the record does not exist in the database a DirectoryNotFoundException is thrown.
| Name | Type | Description |
|---|---|---|
| stream_Id | System.Guid |
Internal method to retriee the metadata for a SqlFileSystemEntry based on it's path.
| Name | Type | Description |
|---|---|---|
| path | System.String |
Retrieves a SqlFileInfo from the SqlFileTable based on its stream_Id.
If the record does not exist in the database a FileNotFoundException is thrown.
| Name | Type | Description |
|---|---|---|
| stream_Id | System.Guid |
Returns a list of all SqlFileInfo that exist in the root of the SqlFileTable. This method provides the functionality similar to GetFiles.
This method has no parameters.
Returns a SqlFileTable from the database based on its Directory_Name.
| Name | Type | Description |
|---|---|---|
| connectionStringProvider | Sql.IO.IConnectionStringProvider | |
| directoryName | System.String |
Returns a list of all SqlFileTables defined in the specified database.
| Name | Type | Description |
|---|---|---|
| connectionStringProvider | Sql.IO.IConnectionStringProvider |
Sql.IO
Domain model for retrieving FileTable meta data from the Sql database.
The name of the directory where the contents of the file exists.
A flag indicating if the FileTable is enabled.
The native object_id for this file table in the Sql Server.
Then name of the FileTable in the Sql Server database.
Sql.IO
Static utilities for working with SqlLocatorIds
An extension to easily convert a Guid to a SqlLocatorId
| Name | Type | Description |
|---|---|---|
| guid | System.Guid |
Sql.IO
Provides utilities from create new Locator Path's used in Native SQL Heirachy Ids.
Initialize a new Sql Locator from a string in the format of [LowValue].[MidValue].[LongValue]
| Name | Type | Description |
|---|---|---|
| locatorId | System.String | A Locator Id in the format of [LowValue].[MidValue].[LongValue] |
Creates a SqlLocatorId from the specified Int64 values.
| Name | Type | Description |
|---|---|---|
| first | System.Int64 | The first value of the SqlLocatorId |
| middle | System.Int64 | the middle value of the SqlLocatorId |
| last | System.Int64 | the last value of the SqlLocatorId |
A static empty buffer for parsing Int64s from a Byte array used to minimize allocations.
A static function for parsing a long from a slice of a Big Edian Byte array.
An array of longs repesented in the SqlLocatorId
The string representation of the Locator Id for this node, formatted as [LowValue].[MidValue].[LongValue]
Creates a new unique SqlLocatorId using NewGuid
This method has no parameters.
Parses a SqlLocatorId from the bytes of a Guid.
| Name | Type | Description |
|---|---|---|
| guid | System.Guid |
Parses the Guids from a path containing SqlLocatorIds.
| Name | Type | Description |
|---|---|---|
| locatorPath | System.String |
Converts the SqlLocatorId to a Guid
This method has no parameters.
The string representation of the SqlLocatorId
This method has no parameters.
A static function to parse GuidBytes from a Little Edian longs.
| Name | Type | Description |
|---|---|---|
| guidBytes | System.Byte[] | The target byte array to copy the Int64Bytes to |
| longValue | System.Int64 | The input Int64 to parse Little Edian Bytes from |
| start | System.Int32 | The start index of the guidBytes to copy to |
| count | System.Int32 | The number of bytes to copy |
Sql.IO
Utility class for parsing SqlPathInfo from file paths;
Parses the FileStreamDirectory segment of a path.
| Name | Type | Description |
|---|---|---|
| path | System.String | The UNC path to parse. |
Gets a SqlFileSystemInfo for the specified path.
| Name | Type | Description |
|---|---|---|
| path | System.String | The path to the SqlFileSystemInfo |
Parses the FileTableDirectory segment of a path.
| Name | Type | Description |
|---|---|---|
| path | System.String | The UNC path to parse. |
Parses the RelativePath segment of a path.
| Name | Type | Description |
|---|---|---|
| path | System.String | The UNC path to parse. |
Gets the root directory information from the specified path.
| Name | Type | Description |
|---|---|---|
| path | System.String | The path to get the root directory information from |
Parses the UncRoot segment of a path.
| Name | Type | Description |
|---|---|---|
| path | System.String | The UNC path to parse. |
Deterimines if the specified path contains a root.
| Name | Type | Description |
|---|---|---|
| path | System.String | The UNC path to parse. |
Sql.IO
A utililty class for parsing the logical directory heirarchy from a supplied path
If present, the name of the File Stream directory parsed from the supplied path.
If present, the name of the FileTable directory parsed from the supplied path.
The Instance name of the Sql Server parsed from the supplied path.
The original path supplied to the parser.
If present, the absolute path, relative to FileStreamDirectory, parsed from the supplied path.
The Machine Name or Virtual Network Name of the SQL server parsed from the supplied path.
The root UNC directory parse from the supplied path. The will be the \ServerName\InstanceName part of the path.
Parses SqlPathInfo from the specified UNC path. At a minimum the path must contain a valid UncRoot or an error will be thrown. The FileStreamDirectory, FileTableDirectory and RelativePath are also parsed if present.
This method has no parameters.
For details specs on path formats, see: https://docs.microsoft.com/en-us/sql/relational-databases/blob/work-with-directories-and-paths-in-filetables?view=sql-server-2017
Sql.IO
A utility class to wrap a prexisiting stream. Used to expose SqlFileStream to external libraries without requiring Custom Dll references. Otherwise, all websites and APIs using this libary would be required to install SqlClr dlls which additionally contains DataTypes not currently support on .Net Stander or .Net Core single SqlFileStream is currently only compatiable with MsSql on windows.
Sql.IO
Concreted implementation of the IConnectionStringProvider allowing a ConnectionString to be resolved using Dependency Injection.
Initialzes a new StringConnectionProvider.
| Name | Type | Description |
|---|---|---|
| connectionString | System.String | The used to open a connection to the database. |
The string that is used to open a connection to the database. See: ConnectionString