RIA StringLength() error message?

Posts   
 
    
ABOH
User
Posts: 148
Joined: 06-Sep-2011
# Posted on: 07-Nov-2011 07:11:56   

Hello,

Your documentation says that it generates code to detect if a string exceeds its length (RIA: StringLength()). I am wondering what kind of error message is generated when a string exceeds its length. Is it localized or do you simply throw an exception? We want to display a localized error message to the user of a DataForm when a string exceeds its length for a database field. Has anyone discussed how to do this task with LLBLGen?

Thank you for your help and suggestions,

Mike

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 07-Nov-2011 08:52:55   
ABOH
User
Posts: 148
Joined: 06-Sep-2011
# Posted on: 08-Nov-2011 00:18:03   

Hi Walaa,

I've reviewed the thread(s), but, unfortunately, they do not answer my question... Basically, I want to know, when using an LLBLGen DAL, how do I provide localized error messages in Silverlight? I understand how to make use of RIA attributes for validation and displaying error messages when using EF41, but what I don't understand is how to accomplish the error messages with LLBLGen. I know how to add RIA attributes in LLBLGen and have done so... What I need to know is the following:

1) LLBLGen does validation of string lengths for fields.... What error messages do you generate for RIA when there is an error?

2) Are your messages localized?

3) If they are localized, what languages are supported?

4) Where are your resource files so we could add additional translations?

5) If you don't provide error messages, then how can I override your RIA validation? Would inserting [Required], [StringLength], [DisplayName] in fields in your designer conflict with your validation?

Thanks,

Mike

****************** Proper RIA Error Message Example ***********************

            [Display(Name = "Voornaam", ResourceType = typeof(Resources.Resources))]
            [Required(ErrorMessageResourceType = typeof(Resources.Resources), ErrorMessageResourceName = "Voornaam_Required")]
            [StringLength(50, ErrorMessageResourceName = "Voornaam_StringLength", ErrorMessageResourceType = typeof(Resources.Resources))]
            public string Voornaam { get; set; }
Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 08-Nov-2011 11:36:16   

LLBLGen Pro doesn't add or have a localized error messages.

As for the RIA StringLength attribute, no error message is generated by default, and the default error message would be used, which is something like:

"The field X must be a T with a maximum length of N".

Where: X is the field name T is the field Type N is the field max length

5) If you don't provide error messages, then how can I override your RIA validation? Would inserting [Required], [StringLength], [DisplayName] in fields in your designer conflict with your validation?

No, it will override the default generated attributes, if a match is found.