I'm trying to use F# to construct a query against a database, but I can't get even the simplest of queries to compile.
I can construct a C# query like this:
from c in Categories
select c
Everything works fine. However, when I try to do what should be the same thing in F#:
query { for c in Categories do
select c }
I get the following error:
Invalid use of a type name and/or object constructor. If necessary use 'new' and apply the constructor to its arguments, e.g. '
new Type(args)
'. The required signature is:Categories() : unit
.
LINQPad comes bundled with a number of samples, but none of the F# samples actually show how to use it to query against a database. I've looked around the internet, also, but I can't find any examples using F# to query a database in LINQPad. What am I missing here?
dc
was it. In 'F# Expression' mode,query { for c in dc.Categories do select c }
works fine. Thanks for pointing me in the right direction. – Basle