I’ve just started playing with F#, and was wondering whether there is any recommended ORM’s out there, for F#.
In C# I used NHibernate, which seems to be quite hard and ugly to implement in F#. I’ve also thought about using plain old System.Data.SqlClient, but thats like going back to the stone age…
Any suggestions?
I’ve been using F# support for LINQ to SQL when working on fssnip.net. It is fine when you need to load, edit, insert entities and it is fine for writing simple queries. It has some nice aspects e.g. you can use splicing to compose parts of a query.
However, the current implementation of F# to LINQ translator doesn’t handle complex queries (nested function calls, advanced grouping and joins), so I wrote a few stored procedures. These can be nicely called via generated LINQ objects, but you have to write some SQL.
Alternatively, if you wanted to use the old fashioned
SqlClient, you could make it nicer by using the dynamic (?) operator. I wrote about this in this blog post. For simple scenarios, this could be quite good technique, because it is very simple.