我正在使用带有 F# 脚本文件的 Visual Studio 2019。
我导入了最新的 nuget 包以在 Azure 表存储中插入和检索实体
Install-Package Microsoft.Azure.Cosmos.Table -Version 1.0.5
插入工作正常,但检索失败并出现以下错误:
验证它:Collections.Generic.IEnumerable = 错误:找不到方法:'System.Threading.Tasks.Task`1 Newtonsoft.Json.JsonReader.ReadAsync(System.Threading.CancellationToken)'。
这是脚本:
#r @"..\.nuget\packages\microsoft.azure.cosmos.table\1.0.5\lib\netstandard2.0\Microsoft.Azure.Cosmos.Table.dll"
#r @"..\.nuget\packages\microsoft.azure.documentdb.core\2.1.3\lib\netstandard1.6\Microsoft.Azure.DocumentDB.Core.dll"
open System
open Microsoft.Azure.Cosmos.Table
type Record(searchModule:string, documentId: Guid, extractDateTime: DateTime, uri: String) =
inherit TableEntity(partitionKey=searchModule, rowKey=documentId.ToString())
new() = Record(null,Guid.Empty,DateTime.MinValue,null)
member val DocumentId = documentId with get, set
member val ExtractDateTime = extractDateTime with get, set
member val Uri = uri with get, set
let connectionString = "DefaultEndpointsProtocol=https;AccountName=XXX;AccountKey=XXX;EndpointSuffix=core.windows.net"
let tableName = "mytable"
let storageAccount = CloudStorageAccount.Parse(connectionString)
let tableClient = storageAccount.CreateCloudTableClient()
let table = tableClient.GetTableReference(tableName)
let searchTerm = "@http://www.microsoft.com"
let query = TableQuery<Record>().Where(TableQuery.GenerateFilterCondition("uri",QueryComparisons.Equal,searchTerm))
let searchResult = table.ExecuteQuery(query)
searchResult
提前致谢