Ticket S30124
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

Validation - Warn end-users about mistakes/inconsistencies without preventing them from saving changes

Validation - Add validation support for business classes implementing the IDXDataErrorInfo interface

created 17 years ago

Users should be allowed to use standard methods to validate their objects. For instance, they would prefer implementing IDXDataErrorInfo interface for data objects instead of using the standard validation system. This feature must be supported in XAF by default.

Comments (2)

    In addition to implementing the interface, pretty please also define an Exception baseclass to be used for XAF, so exceptions can be raised in property setters and / or OnSaving / OnDeleting overrides. This exception could provide certain base properties like the error text; or a message reference ID that could refer to localized messages in the Application Model. Another useful property on this exception class would be a parameter dictionary allowing the XAF subsystem to substitute formatting placeholders with the parameters.
    Short example:
    raise new XpoValidationException("Msg_ID_001", new object[] {obj.Name, obj.Budget - Project.MaxBudget}) where Msg_ID_001 would refer to localizable strings: "The budget for project '{0}' is exceded by {1} dollars".
    I'm pretty sure most developers would like to keep their validation logic contained within the business classes and dedicated exceptions are in my opinion a rather elegant way to propagate validation errors up the system.

    Dennis Garavsky (DevExpress) 17 years ago

      Hi,
      Currently, as a workaround, you need to create a custom grid list editor based on the standard one, and override the GetColumnError type to allow custom ErrorTypes to be displayed in the grid control.
      You also need to add a new controller that will set the column errors. Please look at the GridControlViewController in the attached sample project.
      Thanks,
      Dennis

      Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

      Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.