I am using EDI.Net nuget package. In their Readme.md file, they are talking about "The Picture clause":
The Picture Clause is taken from COBOL laguage and the way it handles expressing numeric and alphanumric data types.
My model looks like this:
[EdiMessage]
public class DeliveryNote
{
[EdiValue("X(9)", Path = "RFF/0/1")]
public string Identification { get; set; }
}
I was hoping to use this EdiValue
-DataAttribute (source code) to validate my models. It looks like they are already parsing those Picture clauses internally in some way.
I could not figure out how to validate my models, yet. The first obvious idea was to use the .NET Validation classes (Validator
, ValidationContext
, ...):
var deliveryNote = new DeliveryNote();
deliveryNote.Identification = null;
var context = new ValidationContext(deliveryNote, serviceProvider: null, items: null);
var validationResults = new List<ValidationResult>();
bool isValid = Validator.TryValidateObject(deliveryNote, context, validationResults, true);
It does not seem, that anything is validated.
Where is my mistake? Can you validate those Picture clauses? If this Picture clause support is not for validation, what is their purpose?