This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I want to customize the error message on a relationship's validator. If I go into the LS Model tab and expand the Entity's option on the tree and then expand an entity's properties I can see the validators for that property and a way to customize the error message. Where is the equivilant for the relationships of an entity?
:D |
|
|
What validator are you referring to? The designer does not support validations on associations. |
|
|
Ok. What I mean is that I have a non-nullable relationship, e.g. an Employee entity must have an EmployeeType. Right now if no EmployeeType is assigned then a message along the lines of "Employee Type is required" is generated. I want to be able to customize this message. Where in the designer can I do this? |
|
|
You can't do it in the designer or even in code: that message is generated internally within LightSpeed. I think the only way to change it would be to create a satellite DLL containing a custom version of the message resource (see the Localisation sample). However this would be a global change rather than a per-association change. If that suffices for you then the resource you would need to supply is called ValidationIsRequired. If you definitely need per-association messages then let me know and I will see if we can implement it (no promises). |
|
|
I need per-association messages I'm afraid. The default messages aren't cutting it with the customer. |
|
|
No worries. The next nightly build will have a "Presence Validation Custom Message" property (on one-to-many associations only, not one-to-one). If you have any hand-coded associations that need this, apply the following to the EntityHolder field: [Validate(typeof(PresenceAssociationValidationRule), "Oh noes!")] Let us know if you run into any problems. Also let us know if you want it backported to 2.x -- we enjoy a good laugh. |
|
|
That's great.
Don't worry, you'll be happy to know that we're upgrading to LightSpeed 3! To celeberate I have a bunch of complex SQL generation regressions that have turned up since upgrading - I'll post them tomorrow. |
|
|
Is this in LS4? I downloaded the April 13 nightly and I don't see this property against a OneToManyAssociationConnecter. I'm using VS2008. |
|
|
Not yet -- it missed the last merge by a couple of hours. It will be in tonight's LS4 nightly. |
|
|
I downloaded the April 15th LS4 beta and I still don't see it in the designer. |
|
|
Turns out I had to uninstall the old LS4 beta first. You might want to check out whether the LS4 beta installer is working correctly and uninstalling old versions. |
|
|
A bug for you: Both the old message and the new custom message show up in the entity's Errors collection. |
|
|
I can't reproduce this. Can you provide us with a complete buildable project, ideally a console application or NUnit test, that exhibits this issue? Thanks! |
|
|
Hrm, I retried it in my app to get you a screenshot and the problem seems to have fixed itself! I'm not sure what happened there - I was definitely getting both sets of messages, bothin the entity's Errors collection when debugging and printed to the website UI. Odd.
It is working as expected now. I'll let you know if I encounter it again. Thanks for your help. |
|