Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Ignite your ASP.NET MVC Applications with Spark View Engine t: @curtis_mitchell e: curtismitchell@gmail.com
What is Spark View Engine? <ul><li>A view engine for ASP.NET MVC and Castle MonoRail that gives you the full capabilities ...
Who is this presentation for?
Who is this presentation for? <ul><li>Web Developers... </li></ul><ul><ul><li>...that use MVC, but want to switch view eng...
Who is this presentation for? <ul><li>Web Developers... </li></ul><ul><ul><li>...that use MVC, but want to switch view eng...
Who is this presentation for? <ul><li>Web Developers... </li></ul><ul><ul><li>...that use MVC, but want to switch view eng...
Who is this presentation for? <ul><li>Web Developers... </li></ul><ul><ul><li>...that use MVC, but want to switch view eng...
...until now!
Agenda <ul><ul><li>History of Spark </li></ul></ul><ul><ul><li>Getting Started </li></ul></ul><ul><ul><li>Basic Concepts <...
Introducing Spark - History http://haacked.com/archive/2008/05/03/code-based-repeater-for-asp.net-mvc.aspx#67579
Getting Started With Spark
Getting Started <ul><ul><li>Create/Open an MVC project  </li></ul></ul><ul><ul><li>Reference Spark.dll and Spark.Mvc.dll <...
Basic Concepts
Basic Concepts <ul><li>Layouts </li></ul><ul><ul><li>LayoutsApplication.Spark </li></ul></ul><ul><ul><li>SharedApplication...
Basic Concepts <ul><li>Named Content </li></ul><ul><ul><li>  <use content=&quot;&quot; /> </li></ul></ul><ul><ul><li><cont...
Basic Concepts <ul><li>Partials </li></ul><ul><ul><li><use file=&quot;&quot; /> </li></ul></ul><ul><ul><li><Partial someVa...
Basic Concepts <ul><ul><li>Variables </li></ul></ul><ul><ul><ul><li><var [var name]=&quot;[value]&quot; type=&quot;[type]&...
Basic Concepts <ul><li>_global.Spark </li></ul><ul><ul><li>Special partial that gets auto-included in a Spark file if it i...
Basic Concepts <ul><li>Control-of-flow statements </li></ul><ul><ul><li><test> statement, <if><else> </li></ul></ul><ul><u...
Advanced Concepts
Advanced Concepts <ul><li>Inline C# </li></ul><ul><ul><li>Use # to delimit any plain ol' C# code </li></ul></ul>
Advanced Concepts <ul><li>Macros </li></ul><ul><ul><li>  Functions/Methods that take arguments and return strings </li></u...
Advanced Concepts <ul><li>These items are beyond this introductory presentation, but Spark supports them: </li></ul><ul><u...
Gotchas <ul><ul><li>Intellisense not working for some types like Html (helpers) </li></ul></ul><ul><ul><ul><li>The backgro...
References and Links <ul><ul><li>http://www.sparkviewengine.com </li></ul></ul><ul><ul><li>http://www.whereslou.com </li><...
[email_address] <ul><li>Thank you for your time and attention! </li></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><ul><...
Upcoming SlideShare
Loading in …5
×

Spark View Engine

3,294 views

Published on

Slides from Spark talk at Raleigh Code Camp 2009

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Spark View Engine

  1. 1. Ignite your ASP.NET MVC Applications with Spark View Engine t: @curtis_mitchell e: curtismitchell@gmail.com
  2. 2. What is Spark View Engine? <ul><li>A view engine for ASP.NET MVC and Castle MonoRail that gives you the full capabilities of C# (and other languages) within your views via an HTML-friendly syntax </li></ul>
  3. 3. Who is this presentation for?
  4. 4. Who is this presentation for? <ul><li>Web Developers... </li></ul><ul><ul><li>...that use MVC, but want to switch view engines </li></ul></ul>
  5. 5. Who is this presentation for? <ul><li>Web Developers... </li></ul><ul><ul><li>...that use MVC, but want to switch view engines </li></ul></ul><ul><ul><li>...that know about Spark, but have been apprehensive about using it </li></ul></ul>
  6. 6. Who is this presentation for? <ul><li>Web Developers... </li></ul><ul><ul><li>...that use MVC, but want to switch view engines </li></ul></ul><ul><ul><li>...that know about Spark, but have been apprehensive about using it </li></ul></ul><ul><ul><li>...that use other view engines like nHaml or nVelocity, but want to learn more about Spark </li></ul></ul>
  7. 7. Who is this presentation for? <ul><li>Web Developers... </li></ul><ul><ul><li>...that use MVC, but want to switch view engines </li></ul></ul><ul><ul><li>...that know about Spark, but have been apprehensive about using it </li></ul></ul><ul><ul><li>...that use other view engines like nHaml or nVelocity, but want to learn more about Spark </li></ul></ul><ul><ul><li>...that just haven't had the time to sit down and learn Spark </li></ul></ul>
  8. 8. ...until now!
  9. 9. Agenda <ul><ul><li>History of Spark </li></ul></ul><ul><ul><li>Getting Started </li></ul></ul><ul><ul><li>Basic Concepts </li></ul></ul><ul><ul><li>Advanced Concepts </li></ul></ul><ul><ul><li>Gotchas </li></ul></ul><ul><ul><li>References </li></ul></ul><ul><ul><li>Wrap-up </li></ul></ul>
  10. 10. Introducing Spark - History http://haacked.com/archive/2008/05/03/code-based-repeater-for-asp.net-mvc.aspx#67579
  11. 11. Getting Started With Spark
  12. 12. Getting Started <ul><ul><li>Create/Open an MVC project </li></ul></ul><ul><ul><li>Reference Spark.dll and Spark.Mvc.dll </li></ul></ul><ul><ul><li>Configure the view engine </li></ul></ul><ul><ul><li>Start using it! </li></ul></ul>
  13. 13. Basic Concepts
  14. 14. Basic Concepts <ul><li>Layouts </li></ul><ul><ul><li>LayoutsApplication.Spark </li></ul></ul><ul><ul><li>SharedApplication.Spark </li></ul></ul><ul><ul><li>View() method </li></ul></ul><ul><ul><li><use master=&quot;layout&quot; /> </li></ul></ul>
  15. 15. Basic Concepts <ul><li>Named Content </li></ul><ul><ul><li>  <use content=&quot;&quot; /> </li></ul></ul><ul><ul><li><content name=&quot;&quot;></content>, <content:name></content:name> </li></ul></ul>
  16. 16. Basic Concepts <ul><li>Partials </li></ul><ul><ul><li><use file=&quot;&quot; /> </li></ul></ul><ul><ul><li><Partial someVar=&quot;&quot; /> </li></ul></ul>
  17. 17. Basic Concepts <ul><ul><li>Variables </li></ul></ul><ul><ul><ul><li><var [var name]=&quot;[value]&quot; type=&quot;[type]&quot; /> or def </li></ul></ul></ul><ul><ul><ul><li><global [var name]=&quot;[value]&quot; type=&quot;[type]&quot; /> </li></ul></ul></ul><ul><ul><ul><li><set [var name]=&quot;[value]&quot; /> </li></ul></ul></ul><ul><ul><li>ViewData  </li></ul></ul><ul><ul><ul><li><viewdata key=&quot;type&quot; /> </li></ul></ul></ul>
  18. 18. Basic Concepts <ul><li>_global.Spark </li></ul><ul><ul><li>Special partial that gets auto-included in a Spark file if it is in the layout folder or the root folder of the view </li></ul></ul><ul><ul><li>Great place to put <using> statements, global variables, or other elements that do not immediately write to the output buffer </li></ul></ul>
  19. 19. Basic Concepts <ul><li>Control-of-flow statements </li></ul><ul><ul><li><test> statement, <if><else> </li></ul></ul><ul><ul><li><for> </li></ul></ul><ul><ul><li>Attributes on html elements </li></ul></ul>
  20. 20. Advanced Concepts
  21. 21. Advanced Concepts <ul><li>Inline C# </li></ul><ul><ul><li>Use # to delimit any plain ol' C# code </li></ul></ul>
  22. 22. Advanced Concepts <ul><li>Macros </li></ul><ul><ul><li>  Functions/Methods that take arguments and return strings </li></ul></ul>
  23. 23. Advanced Concepts <ul><li>These items are beyond this introductory presentation, but Spark supports them: </li></ul><ul><ul><li>Caching of views (partial caching included) </li></ul></ul><ul><ul><li>Precompilation of view classes </li></ul></ul><ul><ul><li>Descriptor Filters for differentiating views based on things like area, theme, or locale </li></ul></ul>
  24. 24. Gotchas <ul><ul><li>Intellisense not working for some types like Html (helpers) </li></ul></ul><ul><ul><ul><li>The background compiler for Spark isn't finding the assemblies </li></ul></ul></ul><ul><ul><ul><li>Copy the assemblies local to resolve </li></ul></ul></ul><ul><ul><li>R#'s intellisense doesn't work with Spark.   </li></ul></ul><ul><ul><ul><li>If using R# and Spark, change R#'s intellisense setting to use Visual Studio's </li></ul></ul></ul><ul><ul><ul><li>Don't use the <namespaces> section in the web.config file.  Use the <using> syntax in the _global.Spark file instead. </li></ul></ul></ul>
  25. 25. References and Links <ul><ul><li>http://www.sparkviewengine.com </li></ul></ul><ul><ul><li>http://www.whereslou.com </li></ul></ul><ul><ul><li>http://www.github.com/loudej/spark </li></ul></ul><ul><ul><li>http://www.dimecasts.net </li></ul></ul>
  26. 26. [email_address] <ul><li>Thank you for your time and attention! </li></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><ul><ul><ul><ul><li>Curtis Mitchell t: @curtis_mitchell e: curtismitchell@gmail.com b: http://www.curtismitchell.com </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>  </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>http://speakerrate.com/talks/1468 </li></ul></ul></ul></ul></ul><ul><li>  </li></ul>

×