![]() |
#11 |
Banned
|
Цитата:
http://kashperuk.blogspot.co.uk/2017...extension.html является статьей двухмесячной давности. Основная описанная проблема - игнорирование аргументов с dictClass.makeObject(). SysExtension framework will instantiate a new instance of the corresponding class (dictClass.makeObject()), which ignores the constructor arguments. Предложенное решение - передавать обьект третьим параметром. In order to account for the constructor arguments we need to use an Instantiation strategy, which can then be passed in as the 3rd argument when calling SysExtensionAppClassFactory. Если посмотреть на сигнатуру SysExtensionAppClassFactory::getClassFromSysAttribute https://msdn.microsoft.com/en-us/lib...attribute.aspx то этот третий параметр существует как [SysExtAppClassDefaultInstantiation _defaultInstantiation]) Если проблема работы с многоуровневой иерархией решается то решается она через class SysExtAppClassDefaultInstantiation implements SysExtensionIInstantiationStrategy И вот эта самая Instantiation Strategy как-то и призвана решить все проблемы. X++: public class BaseClassWithArgInConstructor { //... public static BaseClassWithArgInConstructor construct(NoYesUnchanged _factoryType, str _argument) { NoYesUnchangedFactoryAttribute attr = new NoYesUnchangedFactoryAttribute(_factoryType); BaseClassWithArgInConstructor instance = SysExtensionAppClassFactory::getClassFromSysAttribute( classStr(BaseClassWithArgInConstructor), attr, [B]InstantiationStrategyForClassWithArg::construct(_argument)[/B]); return instance; } }. |
|
Теги |
sysextension framework, sysoperation framework, как правильно, полезное |
|
|