Mar 2, 2012
(0 votes)

Analyzing EPiServer page type source code

Creating pages in EPiServer using PageTypeBuilder is pretty simple and very convenient. However sometimes I run into issue that forgetting to mark page type property as virtual (I suppose this is required for property access interception).

Playing around Microsoft Roslyn project I came up with an idea to analyze the source code for page type builder classes and provide some feedback on analyze results.



Hovering over the property declaration VS gives you a small tooltip that property has to be marked as virtual otherwise runtime exception will be thrown.



Plugin scans only classes that are decorated with PageType attribute and  properties decorated with PageTypeProperty attributes.

There is a space to expand and enrich functionality of such a plugin as for instance develop some FxCop rules designed for PTB specifics, CodeActions to execute if code issue is found (e.g. converting property to virtual property).

Currently it’s only sandbox project utilizing Roslyn possibilities and can be distributed as VS extension (.vsix).

This is just a sneak preview of what’s could be accomplish but I wanted to ask you guys is this something that would be useful and are interested in?

Mar 02, 2012


Joel Abrahamsson
Joel Abrahamsson Mar 5, 2012 10:20 AM

I think this looks interesting and definitely worth pursuing. Personally and at this point in time though, I'd prefer it as a ReSharper extension rather than a Roslyn plug-in.

Mar 5, 2012 11:10 PM

Nah, make it CodeRush plug-in, and I'm in ;-)

valdis Mar 6, 2012 06:52 AM

Hmm, R# and CR plugins seems to be convient as well :)

Please login to comment.
Latest blogs
Preview multiple Visitor Groups directly while browsing your Optimizely site

Visitor groups are great - it's an easy way to add personalization towards market segments to your site. But it does come with it's own set of...

Allan Thraen | Sep 26, 2022 | Syndicated blog

The Report Center is finally back in Optimizely CMS 12

With Episerver.CMS.UI 12.12.0 the Report Center is finally re-introduced in the core product.

Tomas Hensrud Gulla | Sep 26, 2022 | Syndicated blog

Dynamic Route in ASP.NET Core When MapDynamicControllerRoute Does Not Work

Background Creating one of the add-on for Optimizely I had to deal with challenge to register dynamically route for the API controller. Dynamic rou...

valdis | Sep 25, 2022 | Syndicated blog

404 Error on Static Assets Within an Optimizely plugin

Background With the move to CMS 12 and .NET 5/6, developers are now able to build Plugins and Extensions using Razor Class Libraries (RCL).  These...

Mark Stott | Sep 23, 2022