valdis
Mar 2, 2012
  2546
(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

Comments

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
valdis Mar 6, 2012 06:52 AM

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

Please login to comment.
Latest blogs
Performance optimization – the hardcore series – part 2

Earlier we started a new series about performance optimization, here Performance optimization – the hardcore series – part 1 – Quan Mai’s blog...

Quan Mai | Oct 4, 2023 | Syndicated blog

Our first steps into local AI

After a consumer of tools like ChatGPT and CoPilot, we as developers like to dive deeper into it. How does it work? Where to start? Can I create my...

Chuhukon | Oct 4, 2023 | Syndicated blog

Update on .NET 8 support

With .NET 8 now in release candidate stage I want to share an update about our current thinking about .NET 8 support in Optimizely CMS and Customiz...

Magnus Rahl | Oct 3, 2023

Adding Block Specific JavaScript and CSS to the body and head of the page

A common requirement for CMS implementations includes the ability to embed third party content into a website as if it formed part of the website...

Mark Stott | Oct 3, 2023