-
Notifications
You must be signed in to change notification settings - Fork 59
Dynamic Properties
Phillip Haydon edited this page Apr 6, 2014
·
3 revisions
CURRENT NOT AVAILABLE UNTIL NEXT RELEASE
All non-specified properties defined in the header become dynamic properties, this allows you to add what ever your little heart desires to the Post Header
---
layout: post
title: My First Post
categories: new, awesome, general
banana: bananas are yellow
---
The first 3 properties defined are static. The 4th however is not recognised by Snow. So we add it as a dynamic to the Post / PostViewModel
If you define in your ViewBase that the model used is dynamic like so:
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<dynamic>Then you can access the property in your page like so:
index.cshtml view (or any view that renders the paged results)
@Model.Post.bananapost.cshtml view (used to render the full post)
@Model.bananaThis will print the value bananas are yellow
If the property is not defined, the value will be null