en-US/about_SimplySql_Providers.help.txt
TOPIC
about_SimplySql_Providers SHORT DESCRIPTION SimplySql Providers Documentation LONG DESCRIPTION To create a new provider, you need to add a folder under the "Providers" directory. The name of this folder will be the name of the Provider, including capitalization. This folder will contain all the files necessary for the provider to work. There is only one required file: a config file (config.ps1). During module loading, this file is dotsourced. Most providers include an additional provider (provider.ps1) file that creates a subclass of ProviderBase. However, all logic necessary to setup the module must be in the config file. Whether you create the subclass in a separate file (and dotsource to your config.ps1) or create the subclass in your config.ps1 is up to you, but you must subclass ProviderBase. The config file, at the most basic, must create a function to instantiate a connection. Naming convention should be "Open-<Provider>Connection", with "Open-SqlConnection" being reserved for the MSSQL implementation. Any logic necessary for setting up the required libraries must be included in this file as well. The "Open-<Provider>Connection" function must include the following parameter: ConnectionName (with a default of "default"). It is also suggested to include a "CommandTimeout" (default 30) parameter and a "ConnectionString" parameter. The basic pattern of the function:: Check to see if the ConnectionName already exists in the $Script:Connections hashtable, and if so, close that connection (via Close-SqlConnection). Create a new connection object of the appropriate type and attempt to open it. Add an instantiation of your SubClass to the $Script:Connections hashtable with a key equal to ConnectionName. Files to look at Class.ps1 >> contains the implementation of the base class "ProviderBase" that must be subclassed. Providers\SQL\config.ps1 >> example of using only a single file "config.ps1" to implement the provider. Providers\SQLite\config.ps1 >> implementation of SQLite, also uses an additional "provider.ps1" to subclass "ProviderBase". EXAMPLES See the existing providers. KEYWORDS SimplySql, Provider SEE ALSO about_SimplySql |