Private/_SolutionHelpers.ps1

# Helpers for working with Dataverse Solution

function Invoke-SolutionPreOrPostAction {
    Param(
        [string] [Parameter(Mandatory = $true)] $ScriptFolderPath,
        [string] [Parameter(Mandatory = $true)] $ScriptName
    )
    try {
        $ScriptPath = Join-Path $ScriptFolderPath $ScriptName
        if (Test-Path -Path $ScriptPath) {
            Write-Host "Running $ScriptName from $ScriptPath"
            . $ScriptPath -Conn $conn
        }
        else {
            Write-Host "$ScriptName not enabled, create a file called $ScriptName in the location $ScriptFolderPath if you wish to use one" -ForegroundColor Yellow
        }
    }
    catch {
        Write-Host $_
        pause
    }
}