retreatretreat
retreatretreat

Reputation: 13

Fluent Validation for enum type required field

I have a simple enum for validation form.

Painting type is a required field , so I want to make rule for them in Fluent Validator.What should i specify .NotNull() or .NotEmpty()?

public enum VehiclePaintingType
{
    Pearly = 1,
    Metallic,
    Opaque     
}

Upvotes: 0

Views: 3702

Answers (1)

krobelusmeetsyndra
krobelusmeetsyndra

Reputation: 181

As pointed out by Scrobi (and according to the docs), .NotNull() ensures that the specified property is not null, while .NotEmpty() ensures that it is not null, an empty string or a whitespace. So, for your case, it is best to use .NotEmpty().

Upvotes: 1

Related Questions