在下面的C#版本運行時運行下面的代碼的F#版本時出現錯誤。關於如何使用F#從linq查詢返回多個documentdb屬性的任何想法?如何使用DocumentDb,LINQ和F#返回多個屬性?
2016-12-29T23:57:08.504 Exception while executing function: Functions.GetTags. mscorlib: Exception has been thrown by the target of an invocation. mscorlib: One or more errors occurred. Microsoft.Azure.Documents.Client: Constructor invocation is not supported.
C#
var userTagsQuery =
userDocument.Where(user => user.topics != null && user.education != null)
.Select(user => new {topics=user.topics, education=user.education});
F#
type UserTagRecord = {topics : string list; education : string list}
let userTagsQuery =
user.Where(fun user -> user.topics <> null && user.education <> null)
.Select(fun user -> {topics=user.topics :?> string list; education=user.education :?> string list})
我還沒有做任何與documentDB,但也許動態可以幫助你一點? 'FSharp.Interop.Dynamic'和'System.Linq.Dynamic'。然後再次,也許不是... – s952163