Hello guys,
I would appreciate if someone can suggest a way of migrating to AX7 a code from AX2012 which overlayered class constructor. I mean new() method. In the constructor an initialization of existing class variable was changed. The class has public accessor method for the variable.
It appears that I can not implement Post event handler for the New() method as an error is raised: 'cannot be subscribed to by a Pre- or Post-method event handler. The target cannot be a constructor'.
Also I can not implement it in the constructor of the extension class as per the documentation there is no guarantee that extension constructor would be called if no extension method is used: "It's guaranteed that the constructor that is provided in an extension class will be called one time before any instance method or the instance state on the extension class is accessed. However, if no such references are made, the constructor isn't called"
It seems to me that not supporting events for class constructor limits usage of extensions which suggested by Microsoft as main upgrade mechanism.
kind regards,
Ivan
*This post is locked for comments
I have the same question (0)