public/New-GzDbProviderFactory.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function New-DbProviderFactory() {
    <#
        .SYNOPSIS
        Creates a new instance of DbProviderFactory by name.
     
        .DESCRIPTION
        Internally uses `System.Data.Common.DbProviderFactories` to create
        a new DbProviderFactory instance.
     
        .PARAMETER ProviderName
        The of the Database Provider Factory such as
        "System.Data.SqlClient", "MySql.Data.MySqlClient", "Npgsql2 Data Provider"
     
        .EXAMPLE
        $factory = New-DbProviderFactory "System.Data.SqlClient"
     
    #>

        [CmdletBinding()]
        Param(
           [String] $Provider
        )


       


        PROCESS {
            

            return [System.Data.Common.DbProviderFactories]::GetFactory($Provider);
        }
    }