![]() |
#1 |
Участник
|
mfp: SysExtension Framework – to the rescue
Источник: http://blogs.msdn.com/b/mfp/archive/...he-rescue.aspx
============== There is a coding pattern that has been proliferating the X++ code base for years. It is not an X++ best practices – nor is it object oriented; yet it is used quite heavily (unfortunately). Consider a simple class hierarchy with an abstract base class and 3 derived classes. A typical implementation of a factory would be a static method on the base class, like this: (Please ignore the type of the parameter – it could be anything, I choose str for simplicity) ![]() Now; the problems with this approach are many.
SysExtension Framework to the rescue. Consider you decorate the subclasses with an attribute, like depicted here: ![]() Then you can rewrite the factory method to this: ![]() The extension framework returns an instance of the right subclass automatically. It uses the attribute to determine which subclass instance to create. Quite simple – extraordinary powerful! Now notice:
To learn more about the SysExtension framework see here. ============== Источник: http://blogs.msdn.com/b/mfp/archive/...he-rescue.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
Теги |
sysextension |
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|