First off, the "Create Action Wrappers" feature is really useful. When you right-click an Entity and generate the Create and CreateOrUpdate server actions, the platform already checks for Mandatory attributes. If a developer misses assigning a value to a mandatory field, an exception is thrown at the application level. That's a nice touch and saves a lot of headaches.
One thing I noticed though is that for Text attributes, there is no validation on the defined Length. So if a developer passes a string that is longer than the max length set on the attribute, the value still goes through to the database and you get the classic "String or binary data would be truncated" error. That's a database level error, not an application level one, and it gives the developer zero context on which attribute caused the problem.
Since the platform already knows the Length property of each Text attribute (in the Entity definition), it would be great if the generated wrapper could also validate against it. Same pattern as the Mandatory check, just extending it to include a Length check for Text attributes and throw a meaningful exception before it hits the database.
This could help by:
- Making the generated wrappers more complete and consistent
- Giving developers clearer error messages during development and runtime
- Reducing unnecessary database round trips for data that was never going to be accepted anyway
Really appreciate how the platform already handles the Mandatory side of things. This would just be a nice extension of that same thinking.
Would be great to have this for both O11 and ODC. Thanks for considering!