I want to implement a model validation logic on a model entity that contains a model property of string type which represents other property's data type (e.g. Boolean, float, integer, datetime, string).
I want to find out the options available, or potentially the best option.
Below is the model entity:
public class CarEditViewModel
{
public List<CarParameter> CarParameters {get;set;}
//other properties
}
public class CarParameter
{
public virtual int Id { get; set; }
public virtual string Name { get; set; }
public virtual bool ShowHide { get; set; }
public virtual string DefaultValue { get; set; }
public virtual string DataType { get; set; } //can be type of Boolean, float, integer, datetime, string
}
As shown above, the DataType represents the data type of DefaultValue property. The CarEditViewModel is used on MVC edit view. CarEditViewModel contains a collection of CarParameter.
Thanks!