Consider the following scenario. The input json string is deserialized to the Invoice class. The OnDeserializedMethod is called, and the validity check is performed. How can i add the validation erros from the issuer class at the invoice class?
public class Invoice
{
public Dictionary<string, string> ValidationErrors = new Dictionary<string, string>();
public Issuer Issuer { get; set; }
}
public class Issuer
{
public string Vat { get; set; }
[OnDeserialized]
internal void OnDeserializedMethod(StreamingContext context)
{
if (Vat == "")
ValidationErrors.add("1", "Vat cannot be null");
}
}