I often talk about creating web solutions with F# in Visual Studio. Today I'm going to switch things up a little and provide an example of an ASP.NET MVC solution built with MonoDevelop.
MonoDevelop:
For those that aren't familiar with MonoDevelop, it's an open source IDE that runs on a variety of operating systems including Windows, Mac OSX, and Linux. MonoDevelop works hand-in-hand with Mono, which is "an open source, cross-platform, implementation of C# and the CLR that is binary compatible with Microsoft.NET". This means that you can write the same .NET code that you would in Visual Studio and run it on any of the most popular operating systems.
Getting Setup for F# Development:
There are a number of resources out there that talk about how to get your environment setup with MonoDevelop and F#. Here's a quick set of steps:
1. Install MonoDevelop, .NET or Mono, and GTK# from http://monodevelop.com/Download.
2. Launch MonoDevelop and open the Add-in Manager (MonoDevelop | Add-in Manager... on Mac OSX and Tools | Add-in Manager on Windows).
3. Switch to the Gallery tab and install "F# Language Binding".
That's it. You're now ready to start building F# applications with MonoDevelop.
An ASP.NET MVC Project with F# and MonoDevelop:
MonoDevelop also supports ASP.NET MVC. To see an example, clone https://github.com/dmohl/FsMvc4MonoSample and open the solution.
The solution includes 2 projects:
1. A web project that includes Views and Controllers.
2. A unit testing project.
A screenshot of the Solution window is shown below:
Monday, November 19, 2012
Saturday, November 10, 2012
Recording for Building Better Web Apps with F#
Last week, I provided the slides and examples used for my talk entitled Building Better Web Apps with F#. If you missed the presentation, you can watch it here:
2012-10 Building Better Web Apps with FSharp from Ryan Riley on Vimeo.
Presentation - CoffeeScript: Good, Bold, and with Sugar
Thanks to all who came out to the Nashville .NET User Group last Thursday. If you weren't able to make it, you can view the presentation here:
Monday, November 5, 2012
Presentation: Building Better Web Apps with F#
Thanks to all who attended the Community for F# presentation last Tuesday (10/30/2012). Here are the slides from the talk:
The end result of the examples that were built during the presentation can be downloaded from here.
The end result of the examples that were built during the presentation can be downloaded from here.
Monday, October 29, 2012
Using F# Records with ASP.NET Web API
In the Knockout.js and Backbone.js examples that I provided over the last few weeks, the model was written as a class using the traditional syntax. Here's an example:
While this approach works well, it would be great if we could use F# records instead. It turns out that with a few tweaks, this is easy to accomplish. Let's see how to do this in the Knockout.js example.
First, we'll change the model to be an F# record. The new model looks like this:
We'll also need to change how the example data is initialized. This code now looks like this:
Lastly, a small change is needed in the ContactsViewModel. This now looks like the following:
While this approach works well, it would be great if we could use F# records instead. It turns out that with a few tweaks, this is easy to accomplish. Let's see how to do this in the Knockout.js example.
First, we'll change the model to be an F# record. The new model looks like this:
We'll also need to change how the example data is initialized. This code now looks like this:
Lastly, a small change is needed in the ContactsViewModel. This now looks like the following:
Labels:
ASP.NET Web API,
Backbone,
F#,
Knockout,
SIngle Page Application,
SPA
Wednesday, October 17, 2012
Rough Cut of Building Web, Cloud, and Mobile Solutions with F#
Back in May I talked about two books that were currently underway. Today I'm proud to say that one of those books is now available as a Rough Cut on Safari Books Online.
I hope you enjoy reading it as much as I enjoyed writing it! A huge thanks goes to Ryan Riley for his continued expertise and guidance as the technical reviewer.
I hope you enjoy reading it as much as I enjoyed writing it! A huge thanks goes to Ryan Riley for his continued expertise and guidance as the technical reviewer.
Monday, October 15, 2012
Knockout.js Added to the F#/C# MVC 4 Single Page Application Template
Two weeks I announced a new Single Page Application (SPA) template with Backbone.js in the F# C# MVC 4 Visual Studio extension. Last week an example of a SPA with Knockout.js was provided. I bet you can guess what's coming...
Today, you can get version 1.13 of the F# C# MVC 4 extension, which gives you the option to choose between Backbone.js and Knockout.js when creating a F#/C# SPA.
The new project creation screen looks like this:
If you would like to see additional JavaScript frameworks included as options, let me know.
You can find information on the Knockout.js version in this post and information on the Backbone.js version in this post. Note: A C# only version and a PHP version of the Backbone.js example is available at https://github.com/dmohl/FsWebSpa-Backbone/downloads.
Today, you can get version 1.13 of the F# C# MVC 4 extension, which gives you the option to choose between Backbone.js and Knockout.js when creating a F#/C# SPA.
The new project creation screen looks like this:
If you would like to see additional JavaScript frameworks included as options, let me know.
You can find information on the Knockout.js version in this post and information on the Backbone.js version in this post. Note: A C# only version and a PHP version of the Backbone.js example is available at https://github.com/dmohl/FsWebSpa-Backbone/downloads.
Labels:
ASP.NET MVC 4,
ASP.NET Web API,
Backbone,
F#,
Knockout,
Project Templates,
SPA
Subscribe to:
Posts (Atom)