d365technext: Class Extension D365FO
Источник: http://d365technext.blogspot.com/201...on-d365fo.html
==============
Class Extension D365FO
In this blog I will show you class extension in D365 and add new method in the existing class without any over-layer..
There are two way to create Extension of the existing class...
- Static Class
- ExtensionOf
Static class
Create a new public static class use the name pattern ClassName + _Extension
You can use the following code for reference....
publicstaticclassSLD_PaymFee_Extension
{
publicstaticvoid paymfeeFind(PaymFee _this)
{
/// You can write your code here
_this.findFees(); //Use _this to call methods from the base class;
}
}
ExtensionOf
Create new class add the annotation of ExtensionOf and enter the class name... In this type of extension add final keyword.
[ExtensionOf(classStr(PaymFee))]
finalclass SLD_PaymFee_Extension
{
publicstaticvoid paymfeeFind(PaymFee _this)
{
/// You can write your code here
_this.findFees(); //Use _this to call methods from the base class;
}
}
For verification you can use the below code
classSLD_DemoClass
{
publicstaticvoid main(Args _args)
{
PaymFee obj =new PaymFee();
obj.paymfeeFind();
}
}
Источник: http://d365technext.blogspot.com/201...on-d365fo.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
|