Jean Claude Abela
Jean Claude Abela

Reputation: 907

Override ExecuteUpdate/ExecuteSelect in Graph Extension

I am trying to override the Execute update method in a graph extension. First I tried to use the override keyword as in a custom Graph but this is impossible since the GraphExtension does not implement the ExecuteUpdate method. I also tried to use the PXOverride attribute but this resulted in a StackOverflow Exception.

[PXOverride]
public int ExecuteUpdate(string viewName, IDictionary keys, IDictionary values, params object[] parameters)
{
    if (!viewName.Equals("BeneficarySearchVendors"))
        return Base.ExecuteUpdate(viewName, keys, values, parameters); //Throws StackOverflow Exception

    //Other Logic

    return 1;
}

Are there any means to override the ExecuteUpdate and ExecuteSelect in a graph extension?

Thanks

Upvotes: 0

Views: 167

Answers (1)

RuslanDev
RuslanDev

Reputation: 6778

Please refer to the code snippet below for an example of overridden ExecuteUpdate method in a BLC extension:

public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>
{
    public delegate int ExecuteUpdateDelegate(string viewName, 
        IDictionary keys, IDictionary values, object[] parameters);
    [PXOverride]
    public int ExecuteUpdate(string viewName, IDictionary keys, IDictionary values,
        object[] parameters, ExecuteUpdateDelegate baseMethod)
    {
        return baseMethod(viewName, keys, values, parameters);
    }
}

In Code Editor there is an option to generate code snippets to override any virtual method from the base BLC:

enter image description here

Upvotes: 1

Related Questions