1
連接表工作
教我如何提高我的F#LINQ2SQL seqences使用F#LINQ2SQL seqences
這裏我使用LINQ2SQL但我認爲我得到了與它的問題。
和主要問題是這裏的例子,我正在做2嵌入式的,但我得到了非常可怕的linq2 SQL查詢,因爲我不知道在ID訪問是有一些額外的方法或途徑,使其...
member X.deltaArchive() = // Reacting on delta limits
seq { for a in db.ArchiveAnalogs do
for d in db.Deltas do
if a.ID = d.ID then
if a.Value > d.DeltaLimit then
yield d.AboveMessage
else if a.Value < d.DeltaLimit then
yield d.BelowMessage
} |> Array.ofSeq
所以完整的問題是:有沒有什麼辦法可以使相同的,而不使用嵌入的週期來找到id符合性?
謝謝。
補充:
使用:
<@ seq {for a in db.ArchiveAnalogs do
for d in db.Deltas do
if a.ID = d.ID then
if a.Value > d.DeltaLimit then
yield a.Date, d.AboveMessage
else if a.Value < d.DeltaLimit then
yield a.Date, d.BelowMessage}
@> |> query |> Array.ofSeq
遇到錯誤:
The following construct was used in query but is not recognised by the 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, []))])
This is not a valid query expression. Check the specification of permitted queries and consider moving some of the query out of the quotation
offtopic:我必須找到解決方案,因爲這是第一個谷歌鏈接關於「F#linq2sql」
如果我需要yield d.Date,d.AboveMessage,那麼turples又如何呢? – Cynede 2011-02-18 11:13:02