Tuesday, 31 October 2017

Remove base Attribute with Customization

Hi All

In my previous article "Append and Replace of DACs Attributes" I have described how can you replace append attributed in DAC with customization.

Today I would like to add one more useful attribute - PXRemoveBaseAttribute. This one can help you to just remove one specific attribute from base field and replace it with new one if needed.

[PXDBString(32)]
[PXDBDefault("Test")]
[PXUIField(DisplayName = "Test" )]
public String Field { get; set; }

Example 1:
public Extension : PXCacheExtension<DAC>
{
    [PXRemoveBaseAttribute(typeof(PXDefaulAttribute))]
    public String Field { get; set; }
}

Example 2:
public Extension : PXCacheExtension<DAC>
{
    [PXRemoveBaseAttribute(typeof(PXDefaulAttribute))]
    [PXDBDefault("New String")]
    public String Field { get; set; }
}

Have a nice development!

No comments: