|
|
|
|
|
by tarmil
4273 days ago
|
|
WebSharper is completely agnostic in this regard, so the question boils down to what is available for F#. The idiomatic way to deal with databases is using one of the available type providers. Basically, a TP generates types at compile time, in a way that actually plays quite nicely with IntelliSense [1]. In the case of db TPs, they're parameterized by a connection string and connect to the db to extract the schema and generate the appropriate types. Several exist [2]; SqlDataConnection and SqlEntityConnection are built-in, FSharp.Data.SqlClient and FSharp.Data.SqlProvider are community contributed. They all use query expressions (basically, F#'s extensible version of LINQ syntax) except SqlClient which directly uses SQL in a string (but still checks the query at compile time and passes arguments cleanly, thanks to the TP) and is therefore more like a (safer) micro-ORM. [1]: http://msdn.microsoft.com/en-us/library/hh156509.aspx
[2]: http://fsharp.org/guides/data-access/ |
|