DEV Community

Discussion on: Kentico 12: Design Patterns Part 10 - MVC Routing with NodeAliasPath

Collapse
 
deathstarjim profile image
Jim Piller

Sean,

I really like this post, but I'm wondering if you have a complete code example / project on GitHub that you could post here to give a little more context to the snippets. I'm trying to work through using this pattern and I'm having a bit of a hard time, but this post is perfect for what I need on my current project!

Thanks,

Jim Piller

Collapse
 
seangwright profile image
Sean G. Wright

Jim,

Thanks for the feedback and I'm glad the post is helpful.

I don't have any repo with the full picture of this implementation, but I'm planning on writing a follow up about generating URLs when using NodeAliasPath routing. Maybe I could put an example online then.

Was there a specific bit of code you were unsure about?

There shouldn't be too many pieces in then end...

  1. NodeAliasPathConstraint
  2. PageTypeRoute
  3. Static PageTypeRouteAttributeCacheHelper class to do path -> Controller/Action name lookup

You can define these anywhere, though Kentico uses an \Infrastructure\ folder at the root of their MVC codebase and puts these cross-cutting or framework code pieces in there - I think that's a good pattern.