I am a Microsoft dynamics D365FO developer. I was trying to understand why do microsoft uses abstract table type classes for tables. For example, PurchTableType class and PurchLineType classes. Why isn't all those logics are written inside the table itself?.
Should I also consider writting logics under type classes of my custom tables even if there are just minimal methods?
This is rather an exception - there are just a few tables with classes like this.
The reason is that the business logic is very complex and there are several distinct types of orders with specific behavior, such as PurchTableType_Project or PurchTableType_ReturnItem. The class hierarchy allows writing common logic either on the table or in the parent class, and other logic in child classes specific to the given type of order. The table makes polymorphic calls and the logic for the given type of order is executed. Putting all the logic directly on the table would result in very complicated methods and it couldn't utilize inheritance of common logic.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.