Skip to content

mikeobrien/FubuMVC.RegexUrlPolicy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FubuMVC Regex Url Policy

Nuget TeamCity Build Status

The FubuMVC regex url policy allows you to use regular expressions to ignore/include portions of the url as well as constraining actions to verbs.

Installation

PM> Install-Package FubuMVC.RegexUrlPolicy  

Policy DSL

The following demonstrates how to apply the policy:

public class Conventions : FubuRegistry
{        
    public Conventions()
    {    
        Routes.RegexUrlPolicy(x => x.
            .IgnoreAssemblyNamespace()
            .IgnoreClassName()
            .IgnoreMethodNames("Execute")
            .ConstrainClassToGetEndingWith("GetHandler")
            .ConstrainClassToPostEndingWith("PostHandler")
            .ConstrainClassToPutEndingWith("PutHandler")
            .ConstrainClassToUpdateEndingWith("UpdateHandler")
            .ConstrainClassToDeleteEndingWith("DeleteHandler"));    
        ...
    }
}

The policy DSL contains the following methods:

IgnoreNamespace()
IgnoreNamespace<T>()
IgnoreNamespace(Type type)
IgnoreNamespaces(params string[] patterns)

IgnoreAssemblyNamespace()
IgnoreAssemblyNamespace<T>()
IgnoreAssemblyNamespace(Type type)

IgnoreClassName()
IgnoreClassNames(params string[] patterns)

IgnoreMethodName()
IgnoreMethodNames(params string[] patterns)

ConstrainNamespaceTo[Get|Post|Put|Update|Delete](params string[] patterns)
ConstrainNamespaceTo[Get|Post|Put|Update|Delete]StartingWith(params string[] patterns)
ConstrainNamespaceTo[Get|Post|Put|Update|Delete]EndingWith(params string[] patterns)

ConstrainClassTo[Get|Post|Put|Update|Delete](params string[] patterns)
ConstrainClassTo[Get|Post|Put|Update|Delete]StartingWith(params string[] patterns)
ConstrainClassTo[Get|Post|Put|Update|Delete]EndingWith(params string[] patterns)

ConstrainMethodTo[Get|Post|Put|Update|Delete](params string[] patterns)
ConstrainMethodTo[Get|Post|Put|Update|Delete]StartingWith(params string[] patterns)
ConstrainMethodTo[Get|Post|Put|Update|Delete]EndingWith(params string[] patterns)

About

Regex url policy for FubuMVC

Resources

License

Stars

Watchers

Forks

Packages

No packages published