andrewlocatelliwoodcock

Thoughts on Software

Shaver Framework: a more in-depth look at the View Engine

with 9 comments


In my last post, I introduced the open source Shaver View Engine. In this post, I will expand on what Shaver is, what it does (and doesn’t do) and how it does it.

What is Shaver?

Shaver is a framework for an extensible view engine that allows views to be written in Razor syntax, captures the HTML/CSS output using the Razor view engine and then makes that output available for use via extension points so that the original Razor view can be repurposed to produce any output you want or perform additional tasks prior to returning to the browser, or both. If the output you want can be produced from HTML, or make use of HTML, Shaver facilitates it.

Shaver’s task is to capture the output of a standard Razor view and make it available for use for purposes other than those supoprted by Razor. The Shaver View Engine itself doesn’t actually do much more than capture HTML/CSS and make it available via extension points, the interesting stuff that can be done with this information needs to be implemented separately via specialized, concrete implementations of custom view engines that inherit from ShaverViewEngine and ShaverView.

Shaver captures the output and provides an API – that’s all. But that’s still pretty powerful! In the sample custom view engines provided in the Shaver project on GitHub, concrete implementations for several Shaver-based View Engines are supplied: a Logging View Engine that logs the HTML before rendering it, a Mailer View Engine that emails the HTML rendered by Razor and a PDF View Engine that converts the Razor view to a styled PDF. All of these View Engines are roughly version 0.1 but they server to illustrate what can be done and each will have a separate blog post over the next few weeks. Shaver itself is available from: https://github.com/alfamale/Shaver/tree/master/ShaverViewEngine, but it is recommended to download the entire solution: https://github.com/alfamale/Shaver

So let’s have a look at the Shaver API: ShaverViewEngine and ShaverView, followed by some examples of concrete implementations of the Shaver Framework: LoggingViewEngine.

Written by andrewlocatelliwoodcock

November 7, 2011 at 13:53

9 Responses

Subscribe to comments with RSS.

  1. […] a comment » Following on from the last post, let’s start our discussion of the Shaver API with the Shaver View Engine […]

  2. […] in-depth introduction to Shaver LD_AddCustomAttr("AdOpt", "1"); LD_AddCustomAttr("Origin", "other"); […]

  3. […] a comment » Following on from our in-depth introduction to Shaver and the first part of Shaver’s API, the second part of the API is the […]

  4. … [Trackback]…

    […] Informations on that Topic: andrewlocatelliwoodcock.com/2011/11/07/shaver-view-engine-a-more-in-depth-look/ […]…

    giant twist comfort cs

    November 10, 2011 at 17:18

  5. I’ve gone ahead and bookmarked http://andrewlocatelliwoodcock.com/2011/11/07/shaver-view-engine-a-more-in-depth-look/ on Digg.com so i can get a few people to drop in as well. Anyway i like the post “Shaver View Engine: a more in-depth look andrewlocatelliwoodcock” I just used it as the entry title in my Digg.com bookmark, Cheers!.

    Tomika medical

    November 12, 2011 at 09:52

    • Thanks, glad you enjoyed it. There’ll be more articles on the Shaver Framework over the next few weeks so keep an eye out. Also try downloading the source code from GitHub and giving it a spin! Any feedback appreciated … 🙂

      andrewlocatelliwoodcock

      November 24, 2011 at 10:46

  6. I like Your Article about Shaver View Engine: a more in-depth look andrewlocatelliwoodcock Perfect just what I was searching for! .

    sprinkle mediocre apk

    November 13, 2011 at 04:14

  7. […] one comment As I explained in Shaver View Engine: a more in-depth look, Shaver is a framework for an extensible view engine that allows views to be written in Razor […]

  8. Excellent goods from you, man. Shaver Framework: a more in-depth look at the View Engine andrewlocatelliwoodcock I’ve understand your stuff previous to and you are just too magnificent. I actually like what you’ve acquired here, really like what you are saying and the way in which you say it. You make it enjoyable and you still care for to keep it sensible. I can’t wait to read much more from you. This is actually a great Shaver Framework: a more in-depth look at the View Engine andrewlocatelliwoodcock informations.

    minecraft skins

    December 18, 2011 at 09:55


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: