【发布时间】: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