0
votes

I'm using nhibernate validator in my current solution. Everythings is almost fine but...

My view model has a property of type Gender (see example below)

public virtual Gender Gender { get; set; }

public enum Gender { Female = 1, Male = 2 }

Now i like to have some validation to ensure that the gender property ist set. But neither the NotEmpty nor the NotNull Attribute fulfil the requirement.

Is there a kind of a generic solution or best practice to handle enum validations.

Thanks in advance.

1

1 Answers