下面的擴展方法不會在我的ASP.NET Core項目中編譯,並且Visual Studio突出顯示方法ExecuteQuerySegmentedAsync作爲問題。錯誤(代碼下方)引用了我不想要的方法簽名。我想要這個here。Azure存儲表擴展方法中的ExecuteQuerySegmentedAsync調用錯誤
internal static class CloudTableExtensions
{
public static async Task<IList<DynamicTableEntity>> ExecuteQueryAsync(this CloudTable table,
TableQuery query, CancellationToken cancellationToken = default(CancellationToken))
{
var items = new List<DynamicTableEntity>();
TableContinuationToken token = null;
do
{
var seg = await table.ExecuteQuerySegmentedAsync(query, token, cancellationToken);
token = seg.ContinuationToken;
items.AddRange(seg);
} while (token != null && !cancellationToken.IsCancellationRequested
&& (query.TakeCount == null || items.Count < query.TakeCount.Value));
return items;
}
}
的錯誤是: Error CS0411 The type arguments for method 'CloudTable.ExecuteQuerySegmentedAsync<T, TResult>(TableQuery<T>, EntityResolver<TResult>, TableContinuationToken)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
是否使用.NET核心的最新版本?你正在使用哪個版本的windowsazure.storage? – Thomas
是的我正在使用ASP.NET Core 1.0.0和WindowsAzure.Storage 7.1.3-Preview –