We need to create a program that collects runsheets and other form data.
All the forms need to be saved as they're typed, unless explicitly discarded, even the form field data is invalid.
The user should always be able to 'Save for later', or just shut off his window, and data should be saved.
The problem is I'm gonna have to have all the runsheets indexed and searchable, including the invalid ones.
I'm looking at few options:
- Have a subclass of the same type that implements the validation (will that work?)
- Serialize the invalid records as XML and store it somewhere else until its validated and saved permanently.
- Not use validation attributes, but just custom validation (i.e. using
IValidatableObject
interface), that will bypass validation if another property on the record indicates that validation should be skipped, but then I might end up with a lot of data in the database in the same table, maybe this is not a problem as long as I'm control. I'm really considering this option the most.
My real doubt is:
- If I store data elsewhere, searching will be a nightmare
- If I make the validation in an external runtime method, avoiding the use of validation attributes, the columns in the database won't reflect the real property requirements (i.e. required fields).
I think I'll go for this option, because having to search two tables bothers me more, and also because indeed the columns won't be so strict, but I can still set their MaxLength
and some other vital properties that are vital for the database structure but do not really disturb the validation process.
Really it's not that I'll have to store a datetime as a string or going that low.
I just wanted to hear from people who faced a similar situation and might have some smooth magical method...