For a project we are letting employees upload data. This data will all be put into a staging table that is varchars because we don't want to reject the file with bad data. We want to allow someone to fix the invalid fields in a web interface and post the update. We also can't use web field validation because the values are not being loaded through a form but a flat file. We want to iterate over the staging table columns, and have our web service validate each of the fields and ensure they are right (for instance Price might need to be a number but they accidentally typed 'price:123,567.12').
public class SomeClass
{
public string Code { get; set; }
public string CodeDesc { get; set; }
public string Price { get; set; }
}
1 option:
public class SomeClass
{
public string Code { get; set; }
public string CodeIsValid { get; set; }
public List<string> CodeErrorCodes { get; set; }
public string CodeDesc { get; set; }
public string CodeDescIsValid { get; set; }
public List<string> CodeDescErrorCodes { get; set; }
public string Price { get; set; }
public string Price IsValid { get; set; }
public List<string> Price ErrorCodes { get; set; }
}
Option 2. We looked at using IValidateableObject but didn't know if there might be any draw backs to using this and then sending the errors back through a web service.
thanks in advance!
public class SomeClass { public ValidateableProperty Code { get; set; } public ValidateableProperty CodeDesc { get; set; } public ValidateableProperty Price { get; set; } } public class ValidateableProperty { public string value { get; set; } public bool IsValid { get; set; } public List<string> listValidationErrors { get; set; } }