This document describes the PX1098 diagnostic.
| Code | Short Description | Type | Code Fix |
|---|---|---|---|
| PX1098 | Methods with the PXOverride attribute must declare an XML documentation comment with a reference to the base method that has the format /// Overrides <seealso cref="{Base method}">. |
Warning | Available |
Acumatica best practices for methods with the PXOverride attribute require such methods to have an XML documentation comment with a reference to the base method. The format of the comment is the following: /// Overrides <seealso cref="{Base method}">.
This XML comment should not be inside the summary tag or any other XML documentation comment tags because this comment is not a part of method's documentation.
A method with the PXOverride attribute can optionally have other XML documentation comments, but the comment with the Overrides reference must be present.
This Acumatica convention ensures that, for a base method declared in a graph or a graph extension, the reference search feature of the IDE can easily find all PXOverride methods that customize the base method.
The "Overrides" prefix is used to give developers an opportunity to quickly distinguish the detected PXOverride methods from other references to the base method found by reference search.
- The overriding method must be declared in a graph extension.
- The overriding method should not be
static. - The overriding method must have the
publicaccess modifier. - The overriding method cannot be
virtual,abstract, oroverride. - The overriding method cannot be a generic method.
- The signature of the overriding method must be compatible with the signature of the overridden base method. The names of the derived method and the base method must match.
- The overriding method should always declare an additional delegate parameter.
- The base method must be
virtual(have eithervirtualoroverridemodifiers). - The base method must have one of the following accessibility levels:
public,protected, orprotected internal.
The code fix for the PX1098 diagnostic will generate a missing XML documentation comment with a reference to the base method in the required format.
Like many other Acuminator code fixes, this code fix can be used for the entire solution or project to quickly address all places with missing XML comments for methods with the PXOverride attribute.
The following example demonstrates the correct declaration of the PXOverride method.
public class MyGraph : PXGraph<MyGraph>
{
}
public class BaseGraphExtension : PXGraphExtension<MyGraph>
{
public virtual int Add(int x, string y)
{
return x + Convert.ToInt32(y);
}
}
public class DerivedGraphExtension : PXGraphExtension<BaseGraphExtension, MyGraph>
{
/// Overrides <seealso cref="BaseGraphExtension.Add(int, string)"/>
[PXOverride]
public int Add(int x, string y, Func<int, string, int> base_Add)
{
if (x < 10)
{
return x + Convert.ToInt32(y) * 2;
}
return base_Add(x, y);
}
}In the following example, the PXOverride methods do not have the XML doc comments with a reference to the base method in the required format.
public class MyGraph : PXGraph<MyGraph>
{
protected virtual void UpdateBalances()
{
// Implementation
}
}
public class BaseGraphExtension : PXGraphExtension<MyGraph>
{
public virtual int Add(int x, string y)
{
return x + Convert.ToInt32(y);
}
}
public class DerivedGraphExtension : PXGraphExtension<BaseGraphExtension, MyGraph>
{
[PXOverride]
public int Add(int x, string y, Func<int, string, int> base_Add)
{
if (x < 10)
{
return x + Convert.ToInt32(y) * 2;
}
return base_Add(x, y);
}
[PXOverride]
protected void UpdateBalances(Action base_UpdateBalances)
{
base_UpdateBalances();
// Implementation
}
}