How do I get the content part by url with AutoRoute?

Topics: Writing modules
Mar 7, 2012 at 2:46 PM

Hello,

Got into the trouble after upgrade to 1.4.

It was easy to get the content item by querying the RoutePart by Path property. How do I het Content part by url in 1.4 with AutoRoute?

Coordinator
Mar 7, 2012 at 4:41 PM

IAliasHolder. Or IAutoroutePathContraint. 

Mar 9, 2012 at 7:26 AM

Thank you for pointing out the aliases. Unfortunatelly I didn't find the IAutoroutePathContraint class. It seems t

But I've managed to convert the path into RouteValueDictionary with help of IAliasService.Get. Basically this codepart converts the path into two ways:

_aliasService.Lookup(_aliasService.Get(returnUrl))

I'm even able to get VirtualPathData out of _aliasService.LookupVirtualPaths

But, I still stuck by getting the ContentItem out of the path nor RouteValueDictionary.

Mar 9, 2012 at 8:08 AM

Ok, looks like I'm one the right way looking into AutoRoputePart record.

            var routeRecord = _contentManager.Query<AutoroutePartAutoroutePartRecord>()
                .Where(part => part.DisplayAlias != null && part.DisplayAlias.StartsWith(returnUrl))
                .FirstOrDefault()