C# 我在下面的代码中得到PXDefault的发布错误

C# 我在下面的代码中得到PXDefault的发布错误,c#,acumatica,C#,Acumatica,我已经检查了代码的所有大括号和语法,这是唯一发布的代码。我把其他的东西都拿走了 using PX.Objects; using PX.Data; namespace MaxQ.Products.RBRR { public class ContractMaint_Extension : PXGraphExtension<ContractMaint> { #region Event Handlers protected virtual void XRBC

我已经检查了代码的所有大括号和语法,这是唯一发布的代码。我把其他的东西都拿走了

using PX.Objects;
using PX.Data;

namespace MaxQ.Products.RBRR
{
  public class ContractMaint_Extension : PXGraphExtension<ContractMaint>
  {
    #region Event Handlers
   
    protected virtual void XRBContrHdr_DestSiteID_CacheAttached(PXCache cache)
      {   
         [PXDefault(typeof(Search2<INSite.siteCD,
          InnerJoin<BAccount, On<BAccount.bAccountID, Equal<Current<XRBContrHdr.bAccountID>>>,
          InnerJoin<LocationExtAddress, On<LocationExtAddress.locationID, Equal<BAccount.defLocationID>>>>,
          Where<INSite.siteID, Equal<LocationExtAddress.cSiteID>>>), PersistingCheck = PXPersistingCheck.Nothing)]
      }
      
    #endregion
  }
}
使用PX.Objects;
使用PX数据;
命名空间MaxQ.Products.RBRR
{
公共类ContractMaint_扩展:pxGrapherExtension
{
#区域事件处理程序
受保护的虚拟无效XRBConthrdr_DestSiteID_CacheAttached(PXCache缓存)
{   
[PXDefault(typeof(Search2),PersistingCheck=PXPersistingCheck.Nothing)]
}
#端区
}
}
我得到的错误是

\App_RuntimeCode\ContractMaint.cs(13):应为错误CS1513:}

\App_RuntimeCode\ContractMaint.cs(18):错误CS1519:类、结构或接口成员声明中的令牌“}”无效

\App_RuntimeCode\ContractMaint.cs(22):错误CS1022:类型或命名空间定义,或应为文件结尾

\App_RuntimeCode\ContractMaint.cs(13):应为错误CS1513:}


如果是缓存连接的方法,属性在方法上定义,还需要为字段上的属性指定“覆盖”方法。因此,一个有效的例子是

[PXMergeAttributes(Method = MergeMethod.Append)]    
[PXDefault(typeof(Search2<INSite.siteCD,
      InnerJoin<BAccount, On<BAccount.bAccountID, Equal<Current<XRBContrHdr.bAccountID>>>,
      InnerJoin<LocationExtAddress, On<LocationExtAddress.locationID, Equal<BAccount.defLocationID>>>>,
      Where<INSite.siteID, Equal<LocationExtAddress.cSiteID>>>), PersistingCheck = PXPersistingCheck.Nothing)]
virtual void XRBContrHdr_DestSiteID_CacheAttached(PXCache cache) {}
[pxmergattributes(Method=MergeMethod.Append)]
[PXDefault(typeof(Search2),PersistingCheck=PXPersistingCheck.Nothing)]
虚拟无效XRBConthDR_DestSiteID_CacheAttached(PXCache缓存){}

帮助文档将详细解释PXMergeAttributes属性

错误消息指向源代码中格式错误的块{}:

出现这种情况是因为需要将属性放置在方法之前以装饰方法:

[PXDefault(…)]
protected virtual void XRBContrHdr_DestSiteID_CacheAttached(PXCache cache)
{
}
在代码中,属性放在方法定义中,该方法定义在C#中无效:


[PXDefault]
属性需要“应用”某些内容,即属性、字段或方法。谢谢。也就是说,在methodPXMergeAttributes中可以省略它,在这种情况下,它将使用默认的替换模式。来自文档:强制系统使用自定义属性而不是现有属性。如果未在自定义字段上指定PXMergeAttributes属性,则默认情况下使用此选项。
protected virtual void XRBContrHdr_DestSiteID_CacheAttached(PXCache cache)
{
   [PXDefault(…)]
}