F# does not quite understand 'params' arrays, as you have seen; you can pass an empty array

[| |]

as that parameter and it should work I think.

Your 'fluent' code should work if you pass the params-array parameter to CreateQuery/OrderBy, I think.

By on 2/11/2009 10:25 PM ()

Thank you for that information. I didn't know that the params array was a problem in F#, the empty array workaround works for that matter.

As far as the other problem goes, it's still not working, the exception is the same. I tried with the ObjectParameters before the initial post ...

let objectQuery1 = mydbentitites.CreateQuery<NAME>("[NAME]", op1).OrderBy("it.NAME_FULLNAME", op2)

still the same with empty arrays...

let objectQuery1 = mydbentitites.CreateQuery<NAME>("[NAME]", [||]).OrderBy("it.NAME_FULLNAME", [||])

Successive arguments should be separated by spaces or tupled, and arguments involving function or method applications should be parenthesized.

Thx,
Daniel

By on 2/11/2009 10:44 PM ()

If using Visual Studio the squiggles help show the problem.

let objectQuery1 = (mydbentitites.CreateQuery<NAME>("[NAME]", [||])).OrderBy("it.NAME_FULLNAME", [||])

Note the open paren before "mydb..." and close paren before ".OrderBy". I'm not quite sure why the parse turns out that way.

By on 2/11/2009 11:26 PM ()

Thx a lot Brian, even though it seems/looks kind of weird with the additional parenthesis ... and the empty arrays. :-) Is that in both cases the official way to go?

let op = [| new ObjectParameter("NAME_ID1", 10); new ObjectParameter("NAME_ID2", 0) |]

let objectQuery1 = ((mydbentitites.CreateQuery<NAME>("[NAME]", [||])).Where("it.NAME_ID < @NAME_ID1 and it.NAME_ID > @NAME_ID2", op)).OrderBy("it.NAME_FULLNAME", [||])

for name in objectQuery1 do
Console.WriteLine("Test {0}", name.NAME_FULLNAME )

weird is that this doesn't need any extra parenthesis:

let i = (5).ToString().ToString().ToString().ToString()

Thx,
Daniel

By on 2/11/2009 11:56 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper