Reputation: 1941
I needed to add a new field to SOOrder and update attributes of another field. Both classes inherit PXCacheExtension, and both give a PX1011 warning that Because multiple levels of inheritance are not supported for PXCacheExtension, the derived type can be marked as sealed. I had extended it originally from within Acumatica 2018R1 but have moved the code from within the customization project into my Visual Studio Extension Library.
I started with:
public class SOOrderExt : PXCacheExtension<PX.Objects.SO.SOOrder>
If I change the declaration of the class to be:
public sealed class SOOrderExt : PXCacheExtension<PX.Objects.SO.SOOrder>
I get CS0549 SOOrderExt.UsrMyField is a new virtual member in a sealed class 'SOOrderExt'.
Thinking that maybe I missed something and don't need to declare my virtual int?, I commented out:
public virtual int? UsrMyField { get; set; }
and got CS1061 'SOOrderExt' does not contain a definitionfor 'UsrMyField' and no accessible extension method 'UsrMyField; accepting a first argument of type 'SOOrderExt' could be found.
Is the original PX1011 warning something I should ignore, or is there something special needed to follow the guidance to make it sealed or to know that sealing the class is not appropriate?
In short, how do I make these Acuminator warnings go away without simply suppressing and still define my fields?
I'm on 2018R2 Build 18.212.0033 with Visual Studio 2019 Community Edition and Acuminator 1.6.1.
Upvotes: 1
Views: 273
Reputation: 8278
You need to declare the property but the virtual keyword doesn't seem necessary. Otherwise the warning is an oversight if sealed = no virtual and no virtual = no custom fields.
Without virtual keyword this cache extension seems to be working fine:
public sealed class SOLineExt : PXCacheExtension<PX.Objects.SO.SOLine>
{
#region UsrField
[PXDBString(12)]
[PXUIField(DisplayName="Field")]
// Ommit declaring the type as virtual
public /*virtual*/ string UsrField { get; set; }
public abstract class usrField : PX.Data.BQL.BqlString.Field<usrField> { }
#endregion
}
Upvotes: 3