F# query vs C# LINQ
f#
Solution
Although you didn't provide code that fails to compile, I'm guessing you just need to put your object creation expression in parentheses:
query { for row in db.LAYERS do
where (row.LIST1.Field1 = PARAM)
select (new MyClass(row.field1, row.field2, row.field3, row.field4)) }
Problem
This question is more relating to what seems to be verbosity and less clarity on the part of F# compared to C#. A relatively minor issue but one that is becoming quite annoying the more database queries I write. In C# I can do the following with LINQ and Entity Framework: ``` var q = (from row in db.LAYERS where row.LIST1.Field1 == PARAM select new MyClass( row.field1, row.field2, row.field3, row.field4)).ToList() ``` The point is here I am just building a new list of classes inside the query itself. Whereas in F# this does not seem to work and in order to get the same result I'm doing something like this: ``` query { for row in db.LAYERS do where (row.LIST1.Field1 = PARAM) select row.field1, row.field2, row.field3, row.field4 } |> Seq.map (fun row -> new MyClass(row.field1, row.field2, row.field3, row.field4) ``` F# is requiring me to do a map on the query sequence to get the list I want.