frank_lbt
frank_lbt

Reputation: 476

Pass parameter in custom IRouteConstraint

I saw in this article that I can pass parameter to certain built-in route constraint like minlength(value) . How I can achieve the same behaviour with custom IRouteConstraint ?

Upvotes: 1

Views: 239

Answers (1)

frank_lbt
frank_lbt

Reputation: 476

I found a solution: it seems that we simply need to pass this parameter in the constructor.

For exemple:

public class TestRouteConstraint : IRouteConstraint
{
    public TestRouteConstraint(int parameter)
    {
    } 

    ...
}

Upvotes: 1

Related Questions