- Delphi Cookbook
- Daniele Spinetti Daniele Teti
- 155字
- 2025-04-04 16:22:47
BOs validation using RTTI attributes
What does Business Object (BO) mean?
"A business object is an actor within the business layer of a layered object-oriented computer program that represents a part of a business or an item within it.... It represents business entities such as an invoice, a transaction or a person."
- Techopedia
If we fine-tune our applications, we are dealing with BOs—TCustomer, TOrder, and TInvoice are classic examples. In the end we always go to meet the same necessity: their validation; that is, to verify their validity through appropriate procedures. Regardless of whether you use an ORM, a data access framework such as FireDAC, or another, it is always a good idea to develop the BO layer to remain independent of them and respect separation of concerns (SoC).
In this recipe, we'll learn about RTTI Attributes, and we'll see how to use them to solve this problem elegantly.