【问题标题】:Using Azure TableStorage in C# .NET Core - Nuget Package WindowsAzure.Storage Alternative在 C# .NET Core 中使用 Azure TableStorage - Nuget 包 WindowsAzure.Storage 替代方案
【发布时间】:2020-09-11 10:13:03
【问题描述】:

我正在编写一个新应用程序来将日志存储在 Azure 的表存储中。

这是我的存储对象的外观:

public class ErrorLog : TableEntity
{
    public static ErrorLog Create(DateTime dateTime, int httpStatusCode, string message)
        => new ErrorLog
        {
            PartitionKey = GetPartitionKey(dateTime),
            RowKey = GetRowKey(dateTime),
            HttpStatusCode = httpStatusCode,
            Message = message,
        };

    public int HttpStatusCode { get; set; }

    public string Message { get; set; }

    public static string GetPartitionKey(DateTime dateTime) 
        => dateTime.ToString("yyyy_MM_dd_HH");

    public static string GetRowKey(DateTime dateTime)
        => dateTime.ToString("mm_ss");
}

但是,我试图找到要使用的新 NuGet 包而不是“WindowsAzure.Storage”(已被弃用),但无济于事。

【问题讨论】:

  • WindowsAzure.Storage 有什么问题?
  • 该软件包已被弃用。
  • Microsoft.Azure.Cosmos.Table 是与 Azure Tables 一起使用的新包。
  • 你可以在package nuget site找到你应该使用的东西
  • @SergeyVishnevsky,您使用Microsoft.Azure.Cosmos.Table 的评论是正确的。您能否将其发布为答案。

标签: c# .net-core nuget-package azure-table-storage


【解决方案1】:

WindowsAzure.Storage 已被弃用。包Microsoft.Azure.CosmosDB.Table 处于维护模式,很快就会被弃用。您应该使用Microsoft.Azure.Cosmos.Table 库,也可用于访问 Azure 存储表。

【讨论】:

    【解决方案2】:

    Microsoft.Azure.Cosmos.Table 是一个用于 Azure Tables 的新包。 https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Table

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-04-16
      • 1970-01-01
      • 1970-01-01
      • 2014-02-11
      • 2017-09-26
      • 1970-01-01
      • 2020-10-07
      • 2016-09-09
      相关资源
      最近更新 更多