Sending data from a resource to a view in a strongly-typed, but syntactically lightweight manner is not possible with C# or VB.NET.
So check out this screencast of the new "render" macro in NRest!
In a nutshell, my resource looks like:
[Resource("")]public class RootResource{ public Get() : void { def test = 42; render (Foo = "Hello", Bar = "World", test); }}
My VB.NET view looks like:
Public Class RootPage Inherits Page(Of RootPageContent)
Public Overrides Function GetHtml() As XElement Return _ <html> <body><%= Content.Foo %>, <%= Content.Bar %></body> </html> End Function End Class
The RootPageContent DTO class is generated at compile time by the render macro. Everything is strongly-typed.
Powered by: newtelligence dasBlog 2.2.8279.16125
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2010, Andrew Davey
E-mail