[英]Using Azure TableStorage in C# .NET Core - Nuget Package WindowsAzure.Storage Alternative
我正在编写一个新应用程序来将日志存储在 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.CosmosDB.Table处于维护模式,很快就会被弃用。 您应该使用Microsoft.Azure.Cosmos.Table库,也可用于访问 Azure 存储表。
Microsoft.Azure.Cosmos.Table 是一个用于处理 Azure 表的新包。 https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Table
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.