C# Класс AccessProviderSample.AccessDBProvider

Наследование: System.Management.Automation.Provider.NavigationCmdletProvider, IContentCmdletProvider
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
ClearContent ( string path ) : void

Clear the contents at the specified location. In this case, clearing the item amounts to clearing a row

ClearContentDynamicParameters ( string path ) : object

Not implemented.

GetContentReader ( string path ) : IContentReader

Get a reader at the path specified.

GetContentReaderDynamicParameters ( string path ) : object

Not implemented.

GetContentWriter ( string path ) : IContentWriter

Get an object used to write content.

GetContentWriterDynamicParameters ( string path ) : object

Not implemented.

GetNamesFromPath ( string path, string &tableName, int &rowNumber ) : PathType

Chunks the path and returns the table name and the row number from the path

GetRows ( string tableName ) : Collection

Return row information from a specified table.

Защищенные методы

Метод Описание
CopyItem ( string path, string copyPath, bool recurse ) : void

Copies an item at the specified path to the location specified

GetChildItems ( string path, bool recurse ) : void

Return either the tables in the database or the datarows

GetChildName ( string path ) : string

Get the name of the leaf element in the specified path

GetChildNames ( string path, ReturnContainers returnContainers ) : void

Return the names of all child items.

GetItem ( string path ) : void

Retrieves an item using the specified path.

GetParentPath ( string path, string root ) : string

Removes the child segment of the path and returns the remaining parent portion

HasChildItems ( string path ) : bool

Determines if the specified path has child items.

IsItemContainer ( string path ) : bool

Determine if the path specified is that of a container.

IsValidPath ( string path ) : bool

Test to see if the specified path is syntactically valid.

ItemExists ( string path ) : bool

Test to see if the specified item exists.

MakePath ( string parent, string child ) : string

Joins two strings with a provider specific path separator.

MoveItem ( string path, string destination ) : void

Moves the item specified by the path to the specified destination

NewDrive ( PSDriveInfo drive ) : PSDriveInfo

Create a new drive. Create a connection to the database file and set the Connection property in the PSDriveInfo.

NewItem ( string path, string type, object newItemValue ) : void

Creates a new item at the specified path.

NormalizeRelativePath ( string path, string basepath ) : string

Normalizes the path that was passed in and returns the normalized path as a relative path to the basePath that was passed.

RemoveDrive ( PSDriveInfo drive ) : PSDriveInfo

Removes a drive from the provider.

RemoveItem ( string path, bool recurse ) : void

Removes (deletes) the item at the specified path

There are no elements in this store which are hidden from the user. Hence this method will not check for the presence of the Force parameter

SetItem ( string path, object values ) : void

Set the content of a row of data specified by the supplied path parameter.

Приватные методы

Метод Описание
ChunkPath ( string path ) : string[]

Breaks up the path into individual elements.

GetAdapterForTable ( string tableName ) : System.Data.Odbc.OdbcDataAdapter

Obtain a data adapter for the specified Table

An adapter serves as a bridge between a DataSet (in memory representation of table) and the data source

GetDataSetForTable ( System.Data.Odbc.OdbcDataAdapter adapter, string tableName ) : DataSet

Gets the DataSet (in memory representation) for the table for the specified adapter

GetDataTable ( DataSet ds, string tableName ) : DataTable

Get the DataTable object which can be used to operate on for the specified table in the data source

GetNextID ( DataTable table ) : int

Gets the next available ID in the table

GetRow ( string tableName, int row ) : DatabaseRowInfo

Retrieves a single row from the named table.

GetTable ( string tableName ) : DatabaseTableInfo

Retrieve information about a single table.

GetTables ( ) : Collection

Retrieve the list of tables from the database.

NormalizePath ( string path ) : string

Adapts the path, making sure the correct path separator character is used.

PathIsDrive ( string path ) : bool

Checks if a given path is actually a drive name.

RemoveDriveFromPath ( string path ) : string

Ensures that the drive is removed from the specified path

RemoveTable ( string tableName ) : void

Removes the specified table from the database

SafeConvertRowNumber ( string rowNumberAsStr ) : int

Method to safely convert a string representation of a row number into its Int32 equivalent

If there is an exception, -1 is returned

TableIsPresent ( string tableName ) : bool

Checks to see if the specified table is present in the database

TableNameIsValid ( string tableName ) : bool

Check if a table name is valid

Helps to check for SQL injection attacks

ThrowTerminatingInvalidPathException ( string path ) : void

Throws an argument exception stating that the specified path does not represent either a table or a row

Описание методов

ClearContent() публичный Метод

Clear the contents at the specified location. In this case, clearing the item amounts to clearing a row
public ClearContent ( string path ) : void
path string The path to the content to clear.
Результат void

ClearContentDynamicParameters() публичный Метод

Not implemented.
public ClearContentDynamicParameters ( string path ) : object
path string
Результат object

CopyItem() защищенный Метод

Copies an item at the specified path to the location specified
protected CopyItem ( string path, string copyPath, bool recurse ) : void
path string /// Path of the item to copy ///
copyPath string /// Path of the item to copy to ///
recurse bool /// Tells the provider to recurse subcontainers when copying ///
Результат void

GetChildItems() защищенный Метод

Return either the tables in the database or the datarows
protected GetChildItems ( string path, bool recurse ) : void
path string The path to the parent
recurse bool True to return all child items recursively. ///
Результат void

GetChildName() защищенный Метод

Get the name of the leaf element in the specified path
protected GetChildName ( string path ) : string
path string /// The full or partial provider specific path ///
Результат string

GetChildNames() защищенный Метод

Return the names of all child items.
protected GetChildNames ( string path, ReturnContainers returnContainers ) : void
path string The root path.
returnContainers ReturnContainers Not used.
Результат void

GetContentReader() публичный Метод

Get a reader at the path specified.
public GetContentReader ( string path ) : IContentReader
path string The path from which to read.
Результат IContentReader

GetContentReaderDynamicParameters() публичный Метод

Not implemented.
public GetContentReaderDynamicParameters ( string path ) : object
path string
Результат object

GetContentWriter() публичный Метод

Get an object used to write content.
public GetContentWriter ( string path ) : IContentWriter
path string The root path at which to write.
Результат IContentWriter

GetContentWriterDynamicParameters() публичный Метод

Not implemented.
public GetContentWriterDynamicParameters ( string path ) : object
path string
Результат object

GetItem() защищенный Метод

Retrieves an item using the specified path.
protected GetItem ( string path ) : void
path string The path to the item to return.
Результат void

GetNamesFromPath() публичный Метод

Chunks the path and returns the table name and the row number from the path
public GetNamesFromPath ( string path, string &tableName, int &rowNumber ) : PathType
path string Path to chunk and obtain information
tableName string Name of the table as represented in the /// path
rowNumber int Row number obtained from the path
Результат PathType

GetParentPath() защищенный Метод

Removes the child segment of the path and returns the remaining parent portion
protected GetParentPath ( string path, string root ) : string
path string /// A full or partial provider specific path. The path may be to an /// item that may or may not exist. ///
root string /// The fully qualified path to the root of a drive. This parameter /// may be null or empty if a mounted drive is not in use for this /// operation. If this parameter is not null or empty the result /// of the method should not be a path to a container that is a /// parent or in a different tree than the root. ///
Результат string

GetRows() публичный Метод

Return row information from a specified table.
public GetRows ( string tableName ) : Collection
tableName string The name of the database table from /// which to retrieve rows.
Результат Collection

HasChildItems() защищенный Метод

Determines if the specified path has child items.
protected HasChildItems ( string path ) : bool
path string The path to examine.
Результат bool

IsItemContainer() защищенный Метод

Determine if the path specified is that of a container.
protected IsItemContainer ( string path ) : bool
path string The path to check.
Результат bool

IsValidPath() защищенный Метод

Test to see if the specified path is syntactically valid.
protected IsValidPath ( string path ) : bool
path string The path to validate.
Результат bool

ItemExists() защищенный Метод

Test to see if the specified item exists.
protected ItemExists ( string path ) : bool
path string The path to the item to verify.
Результат bool

MakePath() защищенный Метод

Joins two strings with a provider specific path separator.
protected MakePath ( string parent, string child ) : string
parent string /// The parent segment of a path to be joined with the child. ///
child string /// The child segment of a path to be joined with the parent. ///
Результат string

MoveItem() защищенный Метод

Moves the item specified by the path to the specified destination
protected MoveItem ( string path, string destination ) : void
path string /// The path to the item to be moved ///
destination string /// The path of the destination container ///
Результат void

NewDrive() защищенный Метод

Create a new drive. Create a connection to the database file and set the Connection property in the PSDriveInfo.
protected NewDrive ( PSDriveInfo drive ) : PSDriveInfo
drive PSDriveInfo /// Information describing the drive to add. ///
Результат PSDriveInfo

NewItem() защищенный Метод

Creates a new item at the specified path.
protected NewItem ( string path, string type, object newItemValue ) : void
path string /// The path to the new item. ///
type string /// Type for the object to create. "Table" for creating a new table and /// "Row" for creating a new row in a table. ///
newItemValue object /// Object for creating new instance of a type at the specified path. For /// creating a "Table" the object parameter is ignored and for creating /// a "Row" the object must be of type string which will contain comma /// separated values of the rows to insert. ///
Результат void

NormalizeRelativePath() защищенный Метод

Normalizes the path that was passed in and returns the normalized path as a relative path to the basePath that was passed.
protected NormalizeRelativePath ( string path, string basepath ) : string
path string /// A fully qualified provider specific path to an item. The item /// should exist or the provider should write out an error. ///
basepath string /// The path that the return value should be relative to. ///
Результат string

RemoveDrive() защищенный Метод

Removes a drive from the provider.
protected RemoveDrive ( PSDriveInfo drive ) : PSDriveInfo
drive PSDriveInfo The drive to remove.
Результат PSDriveInfo

RemoveItem() защищенный Метод

Removes (deletes) the item at the specified path
There are no elements in this store which are hidden from the user. Hence this method will not check for the presence of the Force parameter
protected RemoveItem ( string path, bool recurse ) : void
path string /// The path to the item to remove. ///
recurse bool /// True if all children in a subtree should be removed, false if only /// the item at the specified path should be removed. Is applicable /// only for container (table) items. Its ignored otherwise (even if /// specified). ///
Результат void

SetItem() защищенный Метод

Set the content of a row of data specified by the supplied path parameter.
protected SetItem ( string path, object values ) : void
path string Specifies the path to the row whose columns /// will be updated.
values object Comma separated string of values
Результат void