Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

Why are table type classes are used?

(0) ShareShare
ReportReport
Posted on by 109
Hi experts, 
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? 
Any points or blogs would help. 
Thanks in advance!
  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,846 Most Valuable Professional on at
    Why are table type classes are used?
    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.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,971 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,846 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans