【问题标题】:ServiceStack #Script Argument in Database Script数据库脚本中的 ServiceStack #Script 参数
【发布时间】:2023-02-03 00:40:47
【问题描述】:

我有以下#Script(ServiceStack 框架)模板。 我想在我的 dbSelect 中使用参数代码。 这怎么可能?

例子:

<small>Some Label</small><header>{{Code}}</header>
{{ 'select * from TrackingEntity WHERE Barcode = @Barcode' |> to => selectSql }}
{{ selectSql |> dbSelect({Barcode: {Code} }) |> htmlDump({ className: 'table styled-table' }) }}

在这行代码中,我试图将参数传递给 dbSelect 函数。

选择SQL|> dbSelect({条码:{代码}})

【问题讨论】:

    标签: c# servicestack


    【解决方案1】:

    dbSelect 接受一个 JS 对象字面量,试试:

    selectSql |> dbSelect({ Barcode: Code })
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-01-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-04
      • 1970-01-01
      相关资源
      最近更新 更多