Views: 1921
Number of votes: 0
Average rating:

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
(By Joel Abrahamsson, 3/5/2012 11:20:21 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.

steve
(By steve, 3/6/2012 12:10:07 AM)

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

valdis
(By valdis, 3/6/2012 7:52:30 AM)

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

Please login to comment.