NXDO.WebAPI 2.6.689.25

dotnet add package NXDO.WebAPI --version 2.6.689.25
                    
NuGet\Install-Package NXDO.WebAPI -Version 2.6.689.25
                    
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="NXDO.WebAPI" Version="2.6.689.25" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NXDO.WebAPI" Version="2.6.689.25" />
                    
Directory.Packages.props
<PackageReference Include="NXDO.WebAPI" />
                    
Project file
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 NXDO.WebAPI --version 2.6.689.25
                    
#r "nuget: NXDO.WebAPI, 2.6.689.25"
                    
#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 NXDO.WebAPI@2.6.689.25
                    
#: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=NXDO.WebAPI&version=2.6.689.25
                    
Install as a Cake Addin
#tool nuget:?package=NXDO.WebAPI&version=2.6.689.25
                    
Install as a Cake Tool

关于 NXDO.WebAPI

NXDO.WebAPI 是一个基与 NetCore 的综合平台,其含有微服务,redis,健康检查,自动实体控制器,成员资格与权限,密的三员管理,VUE单页面,能够通过配置进行快速搭建的业务平台。

工程创建请采用 NXDO 提供的工程模板 NXDO.Addin2022.vsix 在新工程引用 NXDO.WebAPI.N6(N8)

包版本

  • 例:2.5.68.1,其中2为大版本,5为次版本,68(或者6080)则表示为Net6.0与Net8.0支持,最后的1为修订
  • 当包在 Net6.0 下时,其引用文件为 NXDO.WebAPI.N6.dll ,真实版本为 2.5.60.1, 文件后缀N6与版本第三为60均表示为Net6.0
  • 当包在 Net8.0 下时,其引用文件为 NXDO.WebAPI.N8.dll ,真实版本为 2.5.80.1, 文件后缀N8与版本第三为80均表示为Net8.0

绑定地址

包版本 >= 2.6.689.23 时,关于 appsetting.json 中的 urls 节
出于安全考量:设置哪个地址就是哪个地址,不再<font style='color:red;'>自动处理 localhost</font> 到真实IP的绑定。
可指定任意地址:http://0.0.0.0:5000

{
    "urls": "http://0.0.0.0:5000;http://localhost:5001",
    ...
}

主要更新

1.按http访问端口不同,使用不同配置连接不同DB
在 NXDO.WebAPI.josn 的 dbcontext 新节点
可以单独设置 port|ports,也可以都设置
设置 name 为空,则默认使用配置文件:"NXDO.Data.Provider.json" 示例:

    "dbcontext": {
        "enabled": true,
        "configs": [{
                "name": "",
                "port": 5000,
                "ports":[5001]
            }, {
                "name": "NXDO.Data.Provider.PostgreSQL.json",
                "port": 5002
            }]
    },

    "webapi":{
        //...
    }
using NXDO.WebAPI.Web;
public class DbPortController : ApiDbController {
    [HttpGet]
    public object Get() {
        var port = this.HttpContext.GetHttpServerBindPort();
        if (port == 5000 || port == 5001)
            return DbHelper.SetCommand("select * from auser").ExecuteDataTable();
        else if(port == 5002)
            return DbHelper.SetCommand<PgAUser>().ExecuteDataTable();
        else
            return 0;
    }

    //仅在 [dbcontext - enabled : true],当前控制器需要按端口访问,可返回 true    
    protected override bool DbAllowLoadByPort() {
        return true; //默认 base.DbAllowLoadByPort() 返回 false
    }
}

2.导入导出的配置
NXDO.Data.Transfer.json 的 dbProviderIndex 新属性
注意:对应控制器仍然使用,默认配置文件:"NXDO.Data.Provider.json"。不会按端口装载不同配置。 参见代码 NXDO.Data.NPostgreSQL

{
    "transferContext" : {
        "dbProviderIndex": 2,   //空 或 <0:默认Active, 否则 NXDO.Data.Provider.json 中配置数组的索引
        "master": true,         //主系统,否则为分系统
        ...
    }
}

运维系统(朱雀系统)

用于系统运行与维护:朱雀系统

VUE元素权限控制

请使用[朱雀系统]进行授权配置

<template>
    <div>
        
        <uip id="m123" text="Button">
            <el-button>Button</el-button>
        </uip>
        <uip id="m124" text="Button">授权通过,你有 m124 的权限</uip>
    </div>
</template>
<script>
//程序集内置
import uip from './ui.nxdo.vue';
export default {
        components: {
            uip,    
        },
        template: `#template`,
    };
</script>

动态实体控制器支持

1.实体类定义

    public class AUser : NXDO.Data.Entity{
        [Field(Flag = FieldFlag.IsKey | FieldFlag.IsAutoValue)]
        public long UserId { get; set; }

        [Field]public String UserName { get; set; }

        ...
    }

2.实体类控制器 程序启动时,框架自动映射控制器 AUserController

    public class AUserController : 
        NXDO.WebAPI.Controllers.ApiDbEntityController<AUser, long>, 
        NXDO.WebAPI.Controllers.IApiDbEntityController{

        ...
    }

3.注意配置节 需要在 NXDO.WebAPI.josn 的 apiSettings 节中,设置程序集 示例:

{
    "webapi": {
        "apiSettings" : [{
            "namespace": "data", //命名空间,替换 url访问时,路由(routeBaseUrl)定义中 {namespace} 做为url地址。
            "assemblyName": "NXDO.ATest.DataEntity"
        }]
    }

    "swagger": {
        "bindUrl": "http://127.0.0.1:5000", //单一绑定地址

        //net9 默认移除了 swagger,引用swagger程序集后测试仍然可用
        //提供另一方案,替换成由微软主导的 AspNetCoreOpenApi 来生成文档
        //openapi3.0 : nuget 获取 Microsoft.AspNetCore.OpenAPI(>=9.0.0)
        //scalar界面 : nuget拉取 Scalar.AspNetCore(>=1.2.40)
        "replacer": {
            "enabled": true, //true:替换swagger,需nuget拉取 Microsoft.AspNetCore.OpenAPI(>=9.0.0)
            "xml": {
                "include": true,
                "inheritDoc": true
            }
        },
        ...
    }
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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 is compatible.  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.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on NXDO.WebAPI:

Package Downloads
NXDO.WebAPI.ZhuBird

朱雀,亦称朱鸟,形体似凤凰,古代神话中的南方之神。Rosefinch, also known as "Zhu bird" physical may Phoenix, the ancient Chinese myth of the God of the South.

NXDO.WorkFlow

NCore WorkFlow

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.6.689.25 194 11/26/2025
2.6.689.24 456 11/26/2025 2.6.689.24 is deprecated because it has critical bugs.
2.6.689.23 142 7/5/2025
2.6.689.22 215 12/21/2024
2.6.689.21 184 12/14/2024
2.6.689.2 214 12/12/2024
2.6.689.1 183 12/8/2024
2.6.689 216 11/16/2024
2.5.68.5 233 11/13/2024
2.5.68.4 175 11/1/2024
2.5.68.3 220 11/1/2024
2.5.68.2 253 1/18/2024
2.5.68.1 224 12/22/2023
2.4.6080.3 155 12/20/2023
2.4.6080.2 224 12/19/2023

1)支持http不同端口访问使用不同的DB连接,2)导入导出配置支持指定数据源,并对基类进行优化,3)NXDO.WebAPI.json - dbcontext配置节支持,4)为支持后续OPC功能做了功能性的修改与增加