Boss.OpenApi.Script
2026.10.5
dotnet add package Boss.OpenApi.Script --version 2026.10.5
NuGet\Install-Package Boss.OpenApi.Script -Version 2026.10.5
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Boss.OpenApi.Script" Version="2026.10.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Boss.OpenApi.Script" Version="2026.10.5" />
<PackageReference Include="Boss.OpenApi.Script" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Boss.OpenApi.Script --version 2026.10.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Boss.OpenApi.Script, 2026.10.5"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Boss.OpenApi.Script@2026.10.5
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Boss.OpenApi.Script&version=2026.10.5
#tool nuget:?package=Boss.OpenApi.Script&version=2026.10.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Boss.OpenApi.Script
星桥开放服务脚本组件 —— 在 Boss.OpenApi 公共组件之上提供脚本执行开放能力,供组件使用方以 .NET 客户端方式远程执行星桥表达式脚本。
技术栈
net8.0 | 内部基础包 Sup.OpenApi.* / Boss.Script.Define.*(经 Boss.Script.Common 传递引用)
核心能力
OpenBossHelperExtension.ScriptExecute(this OpenBossHelper helper, OpenScriptExecuteDto dto) → Task<OpenScriptExecuteVo?>
拼接 {BaseUrl}{Script.ScriptExecute} 后以 POST 调用开放接口,并返回响应的 Data(即 OpenScriptExecuteVo)。
开放接口契约(脚本执行)
| 项 | 内容 |
|---|---|
| 路由 | POST /app/script/open/script-execute/v1/execute(常量 OpenBossScriptApiPathConst.SCRIPT_EXECUTE) |
| 鉴权 | 免 JWT —— 按入参 Token 做接口授权令牌存在性校验,不校验身份与权限 |
入参 OpenScriptExecuteDto
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
Code |
string | 是 | 表达式代码 |
ProjectCode |
string | 是 | 项目编码(长度 ≤50) |
DbConnectionCode |
string | 否 | 数据库连接编码(长度 ≤50;不传时使用项目默认连接) |
Token |
string | 是 | 接口授权令牌(长度 ≤32) |
Params |
List<ScriptExecuteParamItem> |
否 | 表达式参数集合,每项含 Key(参数名,脚本内以 $("key") 读取,必填)与 Value(参数值,可选) |
出参 OpenScriptExecuteVo
| 字段 | 类型 | 说明 |
|---|---|---|
Result |
object? | 脚本最后一条语句的返回值 |
ElapsedMilliseconds |
long | 执行耗时(毫秒) |
安装
dotnet add package Boss.OpenApi.Script --version 2026.9.1
接入示例
using Boss.OpenApi;
using Boss.OpenApi.Configure;
using Boss.OpenApi.Script.Extension;
using Sup.OpenApi.Extension;
var openBossConfig = new OpenBossConfig
{
BaseUrl = "http://127.0.0.1",
Token = "<接口授权令牌>"
};
iocContainer.AddOpenBoss(openBossConfig);
var helper = new OpenBossHelper(openBossConfig);
var vo = await helper.ScriptExecute(new OpenScriptExecuteDto
{
Code = "$(\"a\") + $(\"b\")",
ProjectCode = "<项目编码>",
Token = "<接口授权令牌>",
Params =
[
new ScriptExecuteParamItem { Key = "a", Value = "1" },
new ScriptExecuteParamItem { Key = "b", Value = "2" }
]
});
Console.WriteLine($"{vo?.Result} ({vo?.ElapsedMilliseconds}ms)");
依赖
Boss.Script.Common2026.9.14Boss.OpenApi2026.9.1
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Boss.OpenApi (>= 2026.10.5)
- Boss.Script.Common (>= 2026.10.22)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Boss.OpenApi.Script:
| Package | Downloads |
|---|---|
|
Boss.OpenApi.Extract
星桥项目开放服务取值组件 |
GitHub repositories
This package is not used by any popular GitHub repositories.