This project is read-only.

Validation issues


When you add a new book and the first time you enter an ASIN of only say 4 digits and click OK the record is added to the datacontext and NO error is reports.
If you try to submit the record back to the database then you get an error stating the ASIN must be 10 digits. If you then fix this and enter a 10 digit ASIN and click OK you get an error because the record has already been added to the datacontext.
This ony seems to be because the first add does not validate the ASIN correctly. Not that if you leave the ASIN blank the first time the required validation is run and works.
Also how do i get validation on the combobox of categories because you can save a book without a category being required ? You cant put a [required] attribute on the Category in the book class so how do you force it to be required ?


stefh wrote Jul 8, 2010 at 1:57 PM

Validation from ASIN is not yet correctly implemented.
See file 'AmazonService.cs', the method : IsValidASIN should check using Amazon

sjariel wrote Jul 9, 2010 at 2:27 AM

sefh I am not sure I follow your comment as the ASIN has validation attributes in the metadata class of

[RegularExpression("^[A-Za-z0-9]{10}$", ErrorMessage = "The ASIN must consist of uppercase letters and digits and be 10 characters long.")]
public static readonly object ASIN = null;

Therefore I would have thought that this validation would have been run on the client. It appears however for some reason that this is not getting validated until it is sent to the server yet the custom validation on the description field is performed on the client.

wrote Feb 13, 2013 at 7:17 PM