linq to sql - Working with connected tables using F# linq2sql seqences -
teach me how can improve f# linq2sql seqences
here i'm using linq2sql think got problems it.
and main problem access id here in example i'm making 2 embedded got scary linq2 sql queries because don't know there additional methods or ways make ...
member x.deltaarchive() = // reacting on delta limits seq { in db.archiveanalogs d in db.deltas if a.id = d.id if a.value > d.deltalimit yield d.abovemessage else if a.value < d.deltalimit yield d.belowmessage } |> array.ofseq
so complete question : there way make same without using embedded cycles find id conformity ?
thank you.
added :
using :
<@ seq {for in db.archiveanalogs d in db.deltas if a.id = d.id if a.value > d.deltalimit yield a.date, d.abovemessage else if a.value < d.deltalimit yield a.date, d.belowmessage} @> |> query |> array.ofseq
got error :
following construct used in query not recognised f#-to-linq query translator: call (none, system.collections.generic.ienumerable`1[system.tuple`2[system.datetime,system.string]] singleton[tuple`2](system.tuple`2[system.datetime,system.string]), [newtuple (propertyget (some (a), system.datetime date, []), propertyget (some (d), system.string abovemessage, []))]) not valid query expression. check specification of permitted queries , consider moving of query out of quotation
offtopic : must find solution because first google link "f# linq2sql"
first of all, snippet wrote isn't using linq sql. you're running whole processing in memory, because f# doesn't select query operators based on type (as c# does). need mark query explicitly run on sql:
#r "fsharp.powerpack.linq.dll" open microsoft.fsharp.linq <@ seq { in db.archiveanalogs ... } @> |> query
an alternative way write want use query.join
function (from powerpack). believe following should trick:
<@ join db.archiveanalogs db.deltas (fun -> a.id) (fun d -> d.id) (fun d -> if a.value > d.deltalimit yield d.abovemessage else if a.value < d.deltalimit yield d.belowmessage ) @> |> query
(although, think there no difference between using join
, nested for
- if run on sql optimize join anyway).
very helpful! Here you will get all kind of solution like
ReplyDeletereset dlink router admin password
routers dlink
D-link Tech Support