Ticket Q292088
Visible to All Users

Exception using Validation on Domain Components

created 14 years ago

I'm trying Domain components for the first time and set up a simple object as follows
    public interface iAccount
    {
        [RuleUniqueValue("Account ID must be unique", DefaultContexts.Save)]
        int ID { get; set; }
     }
Added the validation module to the base module for my app (project atrtached) and when I try to save a record I get the following error.
An exception occurs while validating an object:
  Exception: 'The 'This' property path is incorrect for the 'khacc.Module.iAccount' type because the 'khacc.Module.iAccount.This' member does not exist'
  Rule Id: 'Account ID must be unique'
  Rule Type: 'DevExpress.Persistent.Validation.RuleUniqueValue'
  Target Object: 'Power'

Show previous comments (2)
Dennis Garavsky (DevExpress) 14 years ago

    Hello Richard,
    We appreciate your feedback.
    I also share Roman's position, but as I already mentioned above, it is still possible to force the ID property to be a PK. In order to do this, you should create your own base class and then use it during the registration of your entity. As for a unique Name, I have created a suggestion to provide one more DC attribute, allowing to specify that an index will be created for the respective column in the database.
    Meantime, you can add this index manually in your database table.
    Thanks,
    Dennis

      Thanks for your response.
      I probably will use custom classes rather than interfaces because that should allow me to have a clear, elegant, self documenting database structure. This is a good feature for a general ledger (or any enterprise application) which one can expect to have multple third party accessors that are not XAF based applications.

      Dennis Garavsky (DevExpress) 14 years ago

        See Also:
        Key Attribute DomainComponent
        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.