acumatica - 如何用泛型覆盖方法?
问题描述
我正在尝试覆盖 PIGenerator 图中的UpdateCommandByGenerationMethod方法。
Acumatica 给出了一个空白模板,如下所示:
public delegate BqlCommandWithParameters UpdateCommandByGenerationMethodDelegate(BqlCommandWithParameters cmd);
[PXOverride]
public BqlCommandWithParameters UpdateCommandByGenerationMethod(BqlCommandWithParameters cmd, UpdateCommandByGenerationMethodDelegate baseMethod)
{
/* */
return baseMethod(cmd);
}
这将发布没有错误的罚款。但是当我加载屏幕时。我收到一个错误:
Method PX.Objects.IN.PhysicalInventory.BqlCommandWithParameters UpdateCommandByGenerationMethodTSiteIdField,TInventoryIdField,TSubItemIdField,TLocationIdField 是一个通用的方法定义
说明:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。
异常详细信息: System.ArgumentException: Method PX.Objects.IN.PhysicalInventory.BqlCommandWithParameters UpdateCommandByGenerationMethodTSiteIdField,TInventoryIdField,TSubItemIdField,TLocationIdField 是通用方法定义
Acumatica 中的实际方法签名如下:
protected virtual BqlCommandWithParameters UpdateCommandByGenerationMethod<TSiteIdField, TInventoryIdField, TSubItemIdField, TLocationIdField>(
BqlCommandWithParameters cmd)
where TSiteIdField : IBqlOperand
where TInventoryIdField : IBqlField
where TSubItemIdField : IBqlField
where TLocationIdField : IBqlField
{
...
}
那么如何修复委托方法的声明呢?
提前致谢。
解决方案
不幸的是,如果它使用泛型,则无法 PXOverride 方法
推荐阅读
- mysql - 检查多个表中的数据?
- java - Scala sbt 构建失败并出现 javafx
- c# - 如何将数据从列表上传到 datagridview 列
- apache-spark - 尝试在 PySpark 中使用 partitionBy 写入 csv 时出错
- c++ - 是否可以仅在片段着色器中创建纹理?
- c# - C# 复制具有指定日期和时间范围的文件
- arrays - 如何在 JavaScript 中获取键对象的键
- python - 用python将没有时间的日期解析到mysql中
- c++ - 如何在cpp中处理stringstream中的空格?
- android - 从另一个活动返回后 MainActivity 未恢复