New in ServiceStackVS are a number of different F# Project Templates:
These F# templates follow the same recommended multi-project layout used in the C# templates. In addition, there's also a community created F# ServiceStack extension for ServiceStack (V3 and V4) projects containing different single project configurations.
The example below shows how we can use one of the templates to easily create a Service that serves data from Freebase API, showing the elegance of F#'s' concise, readable code working with ServiceStack's data formats:
For this quick demo, a new F# ASP.NET project was created to show how to expose data from the Freebase API behind ServiceStack Web Services. This API also shows F#'s great integration with the FSharp.Data package. In the demo Games Service, we're returning a preview of the first 10 records from the Video Games list, showing the results in ServiceStack's Auto HTML page as well as in the built-in CSV format.
The steps used to create the demo boil down to:
-
Create a new project using an F# template from ServiceStackVS
-
Add the FSharp.Data NuGet package
Install-Package FSharp.Data
Create our own Freebase client using our own API key:
type FreebaseDataWithKey = FreebaseDataProvider<Key="YouKeyGoesHere",LocalCache=true>Create the Games Request DTO and make it available from the /games Route:
[<Route("/games")>]
type Games() = class endImplement the Games Request method inside the existing MyServices Service and query Video Games from the Freebase API:
member this.Get(request : Games)=
let data = FreebaseDataWithKey.GetDataContext()
let result = query {
for e in data.``Arts and Entertainment``.``Video Games``.``Video Games`` do
take 10
select e } |> Seq.toList
resultThis demo shows off the advantages that come from ServiceStack's design and focus on simplicity as well as F#'s concise and readable syntax.
ServiceStackVS supports both VS.NET 2013 and 2012 and can be downloaded from the Visual Studio Gallery


