AttributeRouting
AttributeRouting copied to clipboard
EnumValueRouteConstraint and Null Value Problem
Hello,
I have the following action:
[GET("Notes?{p:int:min(1)}&{t:notetype?}")]
public virtual ActionResult Index(Int32 p = 1, Int32? t = null) {
}
And the following on my configuration:
x.InlineRouteConstraints.Add("notetype", typeof(EnumValueRouteConstraint<NoteType>));
But I am still able to access "/notes?p=1&t=12"
This shouldn't be possible since NoteEnum only has 3 values: 1, 2 and 3.
If I change {t:notetype?} to {t:notetype} then the notetype constraint works.
However, t does not accept the null value.
Thank You, Miguel