Substantive.CommandExecutor 9.17.13-build20260121r1

Substantive.CommandExecutor

Tags: #PackageReadme #Pending/CleanUp

1. Introduction

CommandExecutor is a comprehensive library designed to facilitate the execution of various command types, including SQL scripts and PowerShell commands. With its robust architecture, the library simplifies the process of executing commands across different environments, making it an essential tool for developers looking to automate and streamline their workflows.

2. Package Readme Document

A. Installation

1. Install The Package

To integrate Substantive.CommandExecutor into project via NuGet Package Manager or by adding a package reference directly into project file (.csproj).

<PackageReference Include="Substantive.CommandExecutor" Version="1.*" />

2. Add Configuration

N/A

3. Configure Services

In program.cs, register Substantive.CommandExecutor's services with the service collection to make them available throughout application. This step is crucial for utilizing the Substantive.CommandExecutor within projects.

builder.Services.AddCommandExecutorTools();

B. Usages

The Substantive.CommandExecutor library provides two main interfaces to cater to different types of command executions: ISqlExecutor and IPowershellExecutor.

Below is a brief overview of how to use these interfaces within your applications.

SQL Command Execution

The ISqlExecutor interface allows for the asynchronous execution of SQL scripts. It is designed to work seamlessly with Entity Framework Core, enabling efficient database interactions.

public interface ISqlExecutor
{
    Task ExecuteAsync(SqlCommandOptions sqlJobOptions, CancellationToken cancellationToken = default);
}
SQL Command Options
{
  "ScriptUri": "Scripts/SqlFiles/example.sql",
  "ConnectionString": "Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;",
  "DatabaseProvider": "MsSqlServer"
}
  • ScriptUri: The relative path to the SQL script file from the application's base directory.
  • ConnectionString: The database connection string required to connect to the database where the SQL commands will be executed. This should be a valid connection string for the specified database provider.
  • DatabaseProvider: Specifies the database provider for which the SQL commands are intended. In this example, MsSqlServer is used, indicating Microsoft SQL Server as the target database system. Currently supported (InMemory, SQLite, MsSqlServer, and PostgreSql)

Powershell Command Execution

The IPowershellExecutor interface facilitates the asynchronous execution of PowerShell scripts to locally, providing a flexible solution for various scripting needs.

Currently the Powershell command execution only support for locally. This tools designed to be support remote execution too.
public interface IPowershellExecutor
{
    Task ExecuteAsync(PowershellCommandOptions powershellJobOptions, CancellationToken cancellationToken = default);
}
Powershell Command Options
{
  "ScriptUri": "Scripts/PowershellFiles/Script.ps1",
  "ExecutionTarget": "Local"
}
  • ScriptUri: The relative path to the PowerShell script file from the application's base directory.
  • ExecutionTarget: Indicates where the PowerShell script will be executed.

C. Example

To use the CommandExecutor library in your application, you would typically inject the necessary executor (ISqlExecutor or IPowershellExecutor) into your services or controllers. Then, you can call the ExecuteAsync method with the appropriate options and a cancellation token if needed.

public class ExecutionService
{
    private readonly ISqlExecutor sqlExecutor;
    private readonly IPowershellExecutor powershellExecutor;

    public ExecutionService(ISqlExecutor sqlExecutor, IPowershellExecutor powershellExecutor)
    {
        this.sqlExecutor = sqlExecutor;
        this.powershellExecutor = powershellExecutor;
    }

    public async Task ExecuteSqlScript()
    {
        var sqlOptions = new SqlCommandOptions
        {
            ScriptUri = new Uri("Scripts/SqlFiles/example.sql", UriKind.Relative),
            ConnectionString = "Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;",
            DatabaseProvider = EFSupportedDatabaseProvider.MsSqlServer // Assuming this is an enum you have defined
        };

        await sqlExecutor.ExecuteAsync(sqlOptions);
    }

    public async Task ExecutePowershellScript()
    {
        var psOptions = new PowershellCommandOptions
        {
            ScriptUri = new Uri("Scripts/PowershellFiles/Sample.ps1", UriKind.Relative),
            ExecutionTarget = ExecutionTarget.Local
        };

        await powershellExecutor.ExecuteAsync(psOptions);
    }
}

Showing the top 20 packages that depend on Substantive.CommandExecutor.

Packages Downloads
Substantive.Foundation.Backends
A metapackage contains all Substantive backend building blocks.
9
Substantive.Foundation.Backends
A metapackage contains all Substantive backend building blocks.
10
Substantive.Foundation.Backends
A metapackage contains all Substantive backend building blocks.
11
Substantive.Foundation.Backends
A metapackage contains all Substantive backend building blocks.
14
Substantive.Foundation.Backends
A metapackage contains all Substantive backend building blocks.
15
Substantive.Foundation.Backends
A metapackage contains all Substantive backend building blocks.
16
Substantive.Foundation.Backends
A metapackage contains all Substantive backend building blocks.
21
Substantive.Foundation.Backends
A metapackage contains all Substantive backend building blocks.
24
Substantive.Metapackage.Backends
A metapackage contains all Substantive backend building blocks.
9

Version Downloads Last updated
9.17.34-build20260919R3 2 09/19/2026
9.17.34-build20260919R2 1 09/19/2026
9.17.34-build20260914R1 2 09/14/2026
9.17.33-build20260715R1 3 07/15/2026
9.17.32-build20260701R1 3 07/01/2026
9.17.31-build20260624R1 5 06/24/2026
9.17.30-build20260616R1 5 06/16/2026
9.17.29-build20260511R1 6 05/11/2026
9.17.28-build20260331R1 10 03/31/2026
9.17.27-build20260306R1 25 03/06/2026
9.17.26-build20260211R1 11 02/11/2026
9.17.25-build20260210R1 9 02/10/2026
9.17.24-build20260209R1 9 02/09/2026
9.17.24-build20260204R1 12 02/04/2026
9.17.23-build20260204R1 7 02/04/2026
9.17.22-build20260204R1 6 02/04/2026
9.17.21-build20260204R2 7 02/04/2026
9.17.21-build20260204R1 6 02/04/2026
9.17.20-build20260203R1 9 02/03/2026
9.17.19-build20260130R1 9 01/30/2026
9.17.18-build20260129R1 9 01/29/2026
9.17.17-build20260129R1 11 01/29/2026
9.17.17-build20260128R1 9 01/28/2026
9.17.16-build20260127R2 10 01/27/2026
9.17.16-build20260123R1 10 01/23/2026
9.17.15-build20260122R1 12 01/22/2026
9.17.14-build20260122R2 12 01/22/2026
9.17.14-build20260122R1 8 01/22/2026
9.17.14-build20260121R1 7 01/21/2026
9.17.13-build20260121R1 7 01/21/2026
9.17.12-build20260120R1 11 01/20/2026
9.17.11-build20260120R1 10 01/20/2026
9.17.10-build20260120R1 10 01/20/2026
9.17.9-build20260119R1 8 01/19/2026
9.17.8-build20260119R1 7 01/19/2026
9.17.7-build20260115R1 6 01/15/2026
9.17.6-build20260115R1 6 01/15/2026
9.17.5-build20260119R1 7 01/19/2026
9.17.5-build20260115R1 6 01/15/2026
9.17.4-build20260115R1 10 01/15/2026
9.17.3-build20260115R1 6 01/15/2026
9.17.2-build20260115R1 6 01/15/2026
9.17.2-build20260113R1 10 01/13/2026
9.17.1-build20251231R2 6 12/31/2025
9.17.1-build20251230R2 11 12/30/2025
9.17.1-build20251230R1 6 12/30/2025
9.17.0-build20251229R2 7 12/29/2025
9.17.0-build20251229R1 6 12/29/2025
9.17.0-build20251226R1 8 12/26/2025
9.17.0-build20251225R1 8 12/25/2025
9.16.0-build20251224R1 9 12/24/2025
9.15.3-build20251224R1 6 12/24/2025
9.15.2-build20251224R1 7 12/24/2025
9.15.1-build20251224R1 7 12/24/2025
9.14.0-build20251223R1 8 12/23/2025
9.3.0-build20251223R4 7 12/23/2025
9.3.0-build20251223R3 7 12/23/2025
9.3.0-build20251223R2 6 12/23/2025
9.3.0-build20251222R2 8 12/22/2025
9.3.0-build20251222R1 6 12/22/2025
9.2.0-build20251222R2 7 12/22/2025
9.2.0-build20251222R1 7 12/22/2025
9.1.0-build20251218R1 7 12/18/2025
9.1.0-build20251217R2 8 12/17/2025
9.1.0-build20251217R1 10 12/17/2025
9.1.0-build20251216R2 11 12/16/2025
9.1.0-build20251216R1 9 12/16/2025
9.1.0-build20251215R1 10 12/15/2025
9.1.0-build20251212R1 11 12/12/2025
9.1.0-build20251211R1 7 12/11/2025
9.1.0-build20251210R1 9 12/10/2025
9.1.0-build20251202R2 11 12/02/2025
9.1.0-build20251202R1 9 12/02/2025
9.0.5-build20251117R1 8 11/17/2025
9.0.5-build20251110R1 13 11/10/2025
9.0.5-build20251103R1 13 11/03/2025
9.0.5-build20251030R1 13 10/30/2025
9.0.5-build20251028R1 11 10/28/2025
9.0.5-build20251016R1 9 10/16/2025
9.0.5-build20250925R2 12 09/25/2025
9.0.5-build20250925R1 8 09/25/2025
9.0.5-build20250924R1 8 09/24/2025
9.0.5-build20250908R1 15 09/08/2025
9.0.5-build20250905R2 11 09/05/2025
9.0.5-build20250905R1 10 09/05/2025
9.0.5-build20250827R1 8 08/27/2025
9.0.5-build20250825R1 13 08/25/2025
9.0.5-build20250821R1 10 08/21/2025
9.0.4-build20250821R1 10 08/21/2025
9.0.3-build20250821R1 11 08/21/2025
9.0.2-build20250821R1 11 08/21/2025
9.0.1-build20250821R1 12 08/21/2025
9.0.0 18 08/16/2025
9.0.0-build20250821R3 11 08/21/2025
9.0.0-build20250821R2 11 08/21/2025
9.0.0-build20250821R1 11 08/21/2025
9.0.0-build20250818R2 13 08/18/2025
9.0.0-build20250818R1 10 08/18/2025
9.0.0-build20250815R1 9 08/15/2025
9.0.0-build20250814R1 9 08/14/2025
9.0.0-build20250722R3 14 07/22/2025
9.0.0-build20250714R3 14 07/14/2025
9.0.0-build20250714R2 10 07/14/2025
9.0.0-build20250714R1 9 07/14/2025
9.0.0-build20250710R1 29 07/10/2025
9.0.0-build20250707R2 17 07/07/2025
9.0.0-build20250707R1 10 07/07/2025
9.0.0-build20250629R1 16 06/29/2025
9.0.0-build20250626R2 13 06/26/2025
9.0.0-build20250626R1 9 06/26/2025
9.0.0-build20250623R1 13 06/23/2025
9.0.0-build20250621R1 18 06/21/2025