🔹 1. find
Method
🔸 Purpose: Retrieves a single record based on the unique key (AccountNum
).
🔸 Parameter _forUpdate
allows the caller to lock the record for update.
🔹 2. exist
Method
🔸 Purpose: Returns true
if the record exists, otherwise false
.
🔹 3. checkExist
Method
🔸 Purpose: Throws an error if the record is not found. Useful for validations in business logic.
🔹 4. txtNotExist
Method
🔸 Purpose: Returns a user-friendly message when the record doesn’t exist. Useful for logging or notifications.
🧠 Why Use These Methods?
-
✅ Centralizes logic
-
✅ Reduces code duplication
-
✅ Improves readability
-
✅ Follows Microsoft-recommended design patterns
💡 Pro Tip
You can also override these methods in your own custom tables (like MySalesContractTable
) following the same pattern—just replace the key field and table name accordingly.
0 Comments