Rumours say the WebForms support in FubuMVC is soon to be abandoned, so let's not stick to the outdated technology and move on. Recently, the Spark integration has been reworked, and the necessary bits added to the official NuGet source, so using Spark in Fubu became so ridiculously simple that you don't have to even know how to pronounce "git" in order to handle it.
Setup
Add the FubuMVC.Spark
NuGet package to your project. Then add one of these lines of code to your registry setup (the ConfigureFubuMVC
constructor created for us by the NuGet installer). The first version is mainstream, and will be used for all View engines (including WebForms):
this.Import<SparkEngine>();
The other one is Spark-specific, and lets you add some engine configuration (which we won't dive into here):
this.UseSpark();
That's it! You can see the whole registry here.
See It In Action
We'll use a simple controller from the previous post:
namespace FubuDemo.Greetings {
public class SayController {
public HelloModel Hi() {
return new HelloModel {Name = "John Doe"};
}
}
}
We'll create a simple Spark view without a master. Note that we have to declare the full model type (without the assembly name). We'll put the view in the same folder as the controller.
<viewdata model="FubuDemo.Greetings.HelloModel" />
<use master=""/>
<html>
<body>
Hi ${Model.Name}!
</body>
</html>
Navigating to the website root will bring us to the page that says "Hi John Doe!
"
Setting Up An OSS Project Can't Be So Simple, Where's the Catch?
No catch, silly. Simpler than drag'n'drop. Try it, it's fun!