You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

为何BIML脚本中RootNode.DbConnections返回Null值?

BIML脚本无法找到已定义连接的问题

环境与问题详情

  • 运行环境:Windows Server 2016,Visual Studio 2015 搭配 BimlExpress 2019
  • 核心问题:执行BIML脚本时触发异常Source connection not found.,确认RootNode.DbConnections["Source"]返回Null值
  • 验证情况:使用相同连接字符串编写C#测试脚本,执行查询select count(*) from test_source.admin_passwords;返回预期结果0,数据库连接状态正常

触发问题的BIML脚本

<Biml xmlns="http://schemas.varigence.com/biml.xsd">
    <Connections>
        <AdoNetConnection Name="Source" Provider="MySql.Data.MySqlClient.MySqlConnection, MySql.Data, Version=8.0.15.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"
            ConnectionString="server=192.168.56.5;user id=root;port=3306;database=test_source;pwd=mysql_root_password" />
    </Connections>
  
<#
    var sourceConnection = RootNode.DbConnections["Source"];
    if (sourceConnection == null)
    {
        throw new Exception("Source connection not found.");
    }
#>

</Biml>

内容的提问来源于stack exchange,提问作者Mike

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 18:56:03