| Author |
Share Topic Topic Search Topic Options
|
ting
IdeaBlade
Joined: 27-Mar-2009
Location: San Francisco
Posts: 427
|
Post Options
Quote Reply
Topic: VerificationEngine.Execute passes but SaveFails Posted: 13-Jul-2010 at 5:58pm |
I made a post on localizing verification error messages here:
Hopefully, that will be enough to get you started.
|
 |
Peter
Newbie
Joined: 14-Jun-2010
Posts: 7
|
Post Options
Quote Reply
Posted: 13-Jul-2010 at 8:44am |
Ok, thanks.. my problem is a bit more straightforward.
I still do not understand why my custom message isn’t showing.
In short,... how do I localize my validation message?
- Can find anything in the DF2010 developer guide.
- Can find any examples of VerifierEngine.ErrorsResourceManager
I’ve read something about silverlight validation Exception versus Validation Notifications.
But not yet understand the issue on the subject.
|
 |
orcities
Senior Member
Joined: 28-Aug-2007
Location: United States
Posts: 454
|
Post Options
Quote Reply
Posted: 13-Jul-2010 at 7:44am |
|
My problem was that I was performing validation from another object. So, when a record was changed for one object it was validating a child object as well. Apparently it doesn't allow this.
|
 |
Peter
Newbie
Joined: 14-Jun-2010
Posts: 7
|
Post Options
Quote Reply
Posted: 13-Jul-2010 at 7:17am |
Hello, is this issue being solved.
I've seem to have a similar problem.
Whatever I do, the error result is always the default generated message ‘Name is Required’
Tried different verifiers.
Only a VerifierDelegate seems to work (I find a VerifierDeletage a bit overkill for just adding localization)
public class VerifierProvider : IVerifierProvider
{
public IEnumerable<Verifier> GetVerifiers(Object pVerifierProviderContext)
{ List<Verifier> verifiers = new List<Verifier>();
verifiers.Add(new RequiredVerifier("Contenttype required a unique name."));
return verifiers;
}
}
private class RequiredVerifier : RequiredValueVerifier
{
public RequiredVerifier(string strMessage) : base( typeof(ContentType), ContentType.EntityPropertyNames.Name)
{ this.VerifierArgs.ErrorMessageInfo.ErrorMessage = strMessage;
}
}
|
 |
ting
IdeaBlade
Joined: 27-Mar-2009
Location: San Francisco
Posts: 427
|
Post Options
Quote Reply
Posted: 08-Jun-2010 at 6:42pm |
No, that looks pretty simple. I saw that you'll be working with someone in our services group. You can have them take a look, or if you can reduce it to a simple test case, open a support case and send the zip.
|
 |
orcities
Senior Member
Joined: 28-Aug-2007
Location: United States
Posts: 454
|
Post Options
Quote Reply
Posted: 08-Jun-2010 at 12:45pm |
|
Any suggestions? See anything in that wouldn't run on the server?
|
 |
orcities
Senior Member
Joined: 28-Aug-2007
Location: United States
Posts: 454
|
Post Options
Quote Reply
Posted: 07-Jun-2010 at 7:38am |
It is the same verifier. Checking that the length of the string is atleast 1 character and sends a specific message. I tried a few different methods but they didn't work as I wanted. The message was never correct. So I did it this way.
public class MinLenghtStringVerifier : StringLengthVerifier
{
public MinLenghtStringVerifier(System.Type pType, string pProperty, string pMessage, int pMin, int pMax)
: base(pType, pProperty, true, pMin, pMax)
{
this.VerifierArgs.ErrorMessageInfo.ErrorMessage = pMessage;
}
}
|
 |
ting
IdeaBlade
Joined: 27-Mar-2009
Location: San Francisco
Posts: 427
|
Post Options
Quote Reply
Posted: 04-Jun-2010 at 3:32pm |
|
I'm not sure. Can you remove the verifiers one by one to isolate the one that is failing for the new objects? We could then look at the code that fails.
|
 |
orcities
Senior Member
Joined: 28-Aug-2007
Location: United States
Posts: 454
|
Post Options
Quote Reply
Posted: 03-Jun-2010 at 6:41pm |
|
That isn't something I want to do. The verification and save work fine on a modified objects. Just not a new objects. Why would that be?
|
 |
ting
IdeaBlade
Joined: 27-Mar-2009
Location: San Francisco
Posts: 427
|
Post Options
Quote Reply
Posted: 03-Jun-2010 at 5:46pm |
We rerun the validation on the server as an additional security check before saving. I'm guessing that one of your custom verifiers is a little more unusal and doesn't like being run on the server (e.g. you might have problems creating another EntityManager on the server). If you need to, you can suppress server-side validation by overriding EntityServerQueryInterceptor.ValidateSave() and not calling the base class implementation.
|
 |
orcities
Senior Member
Joined: 28-Aug-2007
Location: United States
Posts: 454
|
Post Options
Quote Reply
Posted: 03-Jun-2010 at 11:04am |
Ok. This just popped up today.
After I create a new entity, which also creates an associated entity, I then modify the data. For my GUI, devex grid, I force validation using VerifierEngine.Execute on the entity. It passes. Then I go to save and it fails stating that validation failed.
To try and find the issue, thinking it may be mis-match of manager, I ran FindEntities on the manager that have been modified, added, deleted. This returns the entities I created. I then looked at each entity and the values where present that were failing validation.
Basically, all looks well but it is still failing during save for validation.
Please help!!!!!!!!!
|
 |