Azure Tables(對開發者如何理解的工作)
在雲端運算的龐大版圖中,資料儲存在塑造現代應用程式的架構和可擴充性方面扮演舉足輕重的角色。 Azure Table Storage 是 Microsoft Azure 提供的全面管理 NoSQL 資料儲存空間,為開發人員在雲端儲存結構化資料提供多樣化的解決方案。 讓我們踏上探索 Azure Table Storage 功能、用例和優點的旅程。
瞭解 Azure 表儲存
Azure Table Storage 是一種以雲端為基礎的 NoSQL 資料庫服務,提供結構化資料的無模式儲存。 Azure 表提供基於鍵值對的資料模型,其中每個實體由分割鍵和行鍵識別。 此設計能有效率地查詢與擷取資料,非常適合需要快速存取大型資料集的情境。
如果您正在嘗試決定使用 Azure Table Storage 或關係資料庫來管理您的結構化資料,Azure Table Storage 處理大型資料集的能力以及與 Azure Ecosystem 的整合,讓 Azure Table Storage 成為您開發人員工具包中的得力助手。
主要特點和功能
1.Schema-less Design: 與傳統的關聯式資料庫不同,Azure Table Storage 不會對資料強制執行模式。 這種靈活性可讓開發人員在同一表格中儲存結構各異的實體,促進敏捷開發並適應不斷變化的資料需求。
2.可擴充性及效能: Azure 表儲存專為可擴充性而設,能夠輕易處理大量資料。 它可自動擴充以適應不斷增加的工作負載,並提供可預測的效能,因此適用於高吞吐量應用程式和需要低延遲資料存取的場景。
3.分區與負載平衡:Azure 表儲存中的資料會根據分區金鑰進行分區,以便在多個儲存節點之間有效地分配資料。 此分割策略可實現水平擴充和負載平衡,確保最佳效能和資源利用率。
4.次要索引:雖然 Azure 表儲存主要使用分割區鍵和行鍵來進行資料擷取,但它也透過使用複合鍵和查詢投影來支援次要索引。 此功能可讓開發人員執行有效率的範圍查詢,並根據次要屬性篩選資料,提高資料存取模式的靈活性。
5.與 Azure Ecosystem 整合: Azure Table Storage 可與其他 Azure 服務 (例如 Azure Functions、Azure Cosmos DB 和 Azure Logic Apps) 無縫整合,讓開發人員可以輕鬆建立端對端解決方案。 無論是使用無伺服器功能來處理資料流,或是使用進階分析工具來分析資料,Azure Table Storage 都是建立可擴充與彈性應用程式的基礎元件。
使用案例
Azure Table Storage 滿足各行各業廣泛的使用個案,包括
1.Internet of Things (IoT): Azure Table Storage 非常適合儲存來自 IoT 裝置的遙測資料,以實現即時資料擷取、分析及視覺化。 它的擴充性和效能使其成為處理物聯網部署所產生的大量資料的理想選擇。
2.內容管理:對於需要結構化儲存內容元資料的應用程式,例如部落格、文章和使用者產生的內容,Azure Table Storage 可提供符合成本效益且可擴充的解決方案。 它的無模式設計允許靈活的模式演進,以適應內容結構隨時間的變化。
3.會話狀態管理: Azure Table Storage 可用於儲存 Web 應用程式的會話狀態資料,提供分散且可擴充的會話管理解決方案。 透過將會話狀態卸載至 Azure Table Storage,開發人員可以在負載平衡的環境中實現更好的可擴展性、容錯和會話親和性。
4.分散式系統:在分散式系統架構中,Azure Table Storage 是維護元件間共享狀態和協調的基礎資料儲存空間。 它的分割和可擴展性功能使其非常適合需要分散式快取、組態管理以及微服務之間協調的場景。
IronPDF 簡介

IronPDF 是一個 C# PDF 函式庫,可在 .NET 專案中產生、管理 PDF 文件,並從 PDF 文件中萃取內容。 以下是一些主要特點:
- HTML 轉 PDF:
- 將 HTML、CSS 及 JavaScript 內容轉換為 PDF 文件。
- Chrome Rendering Engine 可提供像素完美的 PDF。
- 根據輸入的 URL、HTML 檔案或 HTML 字串產生 PDF。
2.圖片和內容轉換:
- 將影像轉換成 PDF 或從 PDF 轉換成影像。
- 從現有的 PDF 文件中萃取文字和影像。
- 支援 JPG、PNG 等多種圖片格式。
3.編輯和篡改:
- 為 PDF 設定屬性、安全性和權限。
- 新增數位簽章。
- 編輯元資料和修訂歷史。
4.跨平台支援:
- 適用於 .NET Core (8、7、6、5 及 3.1+)、.NET Standard (2.0+) 及 .NET Framework (4.6.2+)。
- 相容於 Windows、Linux 和 macOS。
- 可在 NuGet 上取得,方便安裝。
使用 IronPDF 和 Azure 表生成 PDF 文件
首先,使用 Visual Studio 建立一個控制台應用程式,如下所示:

提供專案名稱:

提供 .NET 版本:

從 NuGet Package Manager 安裝 IronPDF 套件:

為了存取 Azure 表格函式庫,我們將使用 Azure 表格用戶端函式庫,稱為 Azure.Data.Tables,可在 NuGet 套件管理員中找到。 Azure Table Service 客戶端提供與 Azure Table Storage 互動的功能。

建立 Azure Storage 帳戶,開始使用 Azure 表:

按一下審閱與建立。 在您的程式中輸入以下程式碼,即可使用 Azure Tables 來產生 PDF 文件。
using Azure;
using Azure.Data.Tables;
using Azure.Data.Tables.Models;
using IronPdf;
using System;
using System.Linq;
using System.Threading.Tasks;
namespace CodeSample
{
public static class AzureTableDemo
{
public static async Task Execute()
{
var tableName = "IronDemo";
var connectionString = "DefaultEndpointsProtocol=https;AccountName=irondemo;AccountKey=9Pe6LJlkjA721VgWvSuRCMk+WJR5/kFoyPtR1ewjRsNbGJNJOmWYhCB32fakANmWeAcfyIg++iHl+AStDNYlGw==;EndpointSuffix=core.windows.net";
Console.WriteLine("Demo IronPDF with Azure.Data.Tables");
// Enable web security for PDF rendering
Installation.EnableWebSecurity = true;
// Instantiate PDF renderer
var renderer = new ChromePdfRenderer();
// HTML content for the PDF
var content = "<h1>Demo IronPDF with Azure.Data.Tables</h1>";
// Create a TableServiceClient using the connection string
content += "<h2>Create TableServiceClient</h2>";
var serviceClient = new TableServiceClient(connectionString);
content += "<p>var serviceClient = new TableServiceClient(connectionString);</p>";
// Create the table if it does not exist
content += "<h2>Create Table</h2>";
TableItem table = await serviceClient.CreateTableIfNotExistsAsync(tableName);
Console.WriteLine($"Created table: {table.Name}.");
content += $"<p>Created table: {table.Name}.</p>";
// Placeholder for delete table logic
content += "<h2>Deletes If Required</h2>";
// serviceClient.DeleteTable(tableName);
content += "<p>serviceClient.DeleteTable(tableName);</p>";
// Get a client reference to interact with the table
content += "<h2>Get Table Client</h2>";
var tableClient = serviceClient.GetTableClient(tableName);
content += "<p>var tableClient = serviceClient.GetTableClient(tableName);</p>";
// Define and add a new entity to the table
content += "<h2>Add Table Entity</h2>";
var tableEntity = new TableEntity { { "Book", "Awesome IronPDF Package" }, { "Price", 5.00 }, { "Quantity", 21 } };
tableEntity.PartitionKey = tableEntity["Book"].ToString();
tableEntity.RowKey = tableEntity["Price"].ToString();
content += "<p>new TableEntity() { { \"Book\", \"Awesome IronPDF Package\" }, { \"Price\", 5.00 }, { \"Quantity\", 21 } }</p>";
content += $"<p>tableEntity.PartitionKey = {tableEntity["Book"]}</p>";
content += $"<p>tableEntity.RowKey = {tableEntity["Price"]}</p>";
Console.WriteLine($"{tableEntity.RowKey}: {tableEntity["Book"]} costs ${tableEntity.GetDouble("Price")}.");
content += $"<p>{tableEntity.RowKey}: {tableEntity["Book"]} costs ${tableEntity.GetDouble("Price")}</p>";
// Add the entity to the table
tableClient.AddEntity(tableEntity);
content += "<p>Entity added.</p>";
// Query the table
content += "<h2>Query Table</h2>";
Pageable<TableEntity> queryResultsFilter = tableClient.Query<TableEntity>(filter: $"PartitionKey eq '{tableEntity.PartitionKey}'");
content += "<p>Using tableClient.Query<TableEntity></p>";
// Iterate and display queried entities
foreach (TableEntity qEntity in queryResultsFilter)
{
content += $"<p>{qEntity.GetString("Book")}: {qEntity.GetDouble("Price")}</p>";
Console.WriteLine($"{qEntity.GetString("Book")}: {qEntity.GetDouble("Price")}");
}
Console.WriteLine($"The query returned {queryResultsFilter.Count()} entities.");
content += $"<p>The query returned {queryResultsFilter.Count()} entities.</p>";
// Render HTML content as PDF
var pdf = renderer.RenderHtmlAsPdf(content);
// Save the PDF to a file
pdf.SaveAs("AwesomeAzureDataTables.pdf");
}
}
}
using Azure;
using Azure.Data.Tables;
using Azure.Data.Tables.Models;
using IronPdf;
using System;
using System.Linq;
using System.Threading.Tasks;
namespace CodeSample
{
public static class AzureTableDemo
{
public static async Task Execute()
{
var tableName = "IronDemo";
var connectionString = "DefaultEndpointsProtocol=https;AccountName=irondemo;AccountKey=9Pe6LJlkjA721VgWvSuRCMk+WJR5/kFoyPtR1ewjRsNbGJNJOmWYhCB32fakANmWeAcfyIg++iHl+AStDNYlGw==;EndpointSuffix=core.windows.net";
Console.WriteLine("Demo IronPDF with Azure.Data.Tables");
// Enable web security for PDF rendering
Installation.EnableWebSecurity = true;
// Instantiate PDF renderer
var renderer = new ChromePdfRenderer();
// HTML content for the PDF
var content = "<h1>Demo IronPDF with Azure.Data.Tables</h1>";
// Create a TableServiceClient using the connection string
content += "<h2>Create TableServiceClient</h2>";
var serviceClient = new TableServiceClient(connectionString);
content += "<p>var serviceClient = new TableServiceClient(connectionString);</p>";
// Create the table if it does not exist
content += "<h2>Create Table</h2>";
TableItem table = await serviceClient.CreateTableIfNotExistsAsync(tableName);
Console.WriteLine($"Created table: {table.Name}.");
content += $"<p>Created table: {table.Name}.</p>";
// Placeholder for delete table logic
content += "<h2>Deletes If Required</h2>";
// serviceClient.DeleteTable(tableName);
content += "<p>serviceClient.DeleteTable(tableName);</p>";
// Get a client reference to interact with the table
content += "<h2>Get Table Client</h2>";
var tableClient = serviceClient.GetTableClient(tableName);
content += "<p>var tableClient = serviceClient.GetTableClient(tableName);</p>";
// Define and add a new entity to the table
content += "<h2>Add Table Entity</h2>";
var tableEntity = new TableEntity { { "Book", "Awesome IronPDF Package" }, { "Price", 5.00 }, { "Quantity", 21 } };
tableEntity.PartitionKey = tableEntity["Book"].ToString();
tableEntity.RowKey = tableEntity["Price"].ToString();
content += "<p>new TableEntity() { { \"Book\", \"Awesome IronPDF Package\" }, { \"Price\", 5.00 }, { \"Quantity\", 21 } }</p>";
content += $"<p>tableEntity.PartitionKey = {tableEntity["Book"]}</p>";
content += $"<p>tableEntity.RowKey = {tableEntity["Price"]}</p>";
Console.WriteLine($"{tableEntity.RowKey}: {tableEntity["Book"]} costs ${tableEntity.GetDouble("Price")}.");
content += $"<p>{tableEntity.RowKey}: {tableEntity["Book"]} costs ${tableEntity.GetDouble("Price")}</p>";
// Add the entity to the table
tableClient.AddEntity(tableEntity);
content += "<p>Entity added.</p>";
// Query the table
content += "<h2>Query Table</h2>";
Pageable<TableEntity> queryResultsFilter = tableClient.Query<TableEntity>(filter: $"PartitionKey eq '{tableEntity.PartitionKey}'");
content += "<p>Using tableClient.Query<TableEntity></p>";
// Iterate and display queried entities
foreach (TableEntity qEntity in queryResultsFilter)
{
content += $"<p>{qEntity.GetString("Book")}: {qEntity.GetDouble("Price")}</p>";
Console.WriteLine($"{qEntity.GetString("Book")}: {qEntity.GetDouble("Price")}");
}
Console.WriteLine($"The query returned {queryResultsFilter.Count()} entities.");
content += $"<p>The query returned {queryResultsFilter.Count()} entities.</p>";
// Render HTML content as PDF
var pdf = renderer.RenderHtmlAsPdf(content);
// Save the PDF to a file
pdf.SaveAs("AwesomeAzureDataTables.pdf");
}
}
}
Imports Azure
Imports Azure.Data.Tables
Imports Azure.Data.Tables.Models
Imports IronPdf
Imports System
Imports System.Linq
Imports System.Threading.Tasks
Namespace CodeSample
Public Module AzureTableDemo
Public Async Function Execute() As Task
Dim tableName = "IronDemo"
Dim connectionString = "DefaultEndpointsProtocol=https;AccountName=irondemo;AccountKey=9Pe6LJlkjA721VgWvSuRCMk+WJR5/kFoyPtR1ewjRsNbGJNJOmWYhCB32fakANmWeAcfyIg++iHl+AStDNYlGw==;EndpointSuffix=core.windows.net"
Console.WriteLine("Demo IronPDF with Azure.Data.Tables")
' Enable web security for PDF rendering
Installation.EnableWebSecurity = True
' Instantiate PDF renderer
Dim renderer = New ChromePdfRenderer()
' HTML content for the PDF
Dim content = "<h1>Demo IronPDF with Azure.Data.Tables</h1>"
' Create a TableServiceClient using the connection string
content &= "<h2>Create TableServiceClient</h2>"
Dim serviceClient = New TableServiceClient(connectionString)
content &= "<p>var serviceClient = new TableServiceClient(connectionString);</p>"
' Create the table if it does not exist
content &= "<h2>Create Table</h2>"
Dim table As TableItem = Await serviceClient.CreateTableIfNotExistsAsync(tableName)
Console.WriteLine($"Created table: {table.Name}.")
content &= $"<p>Created table: {table.Name}.</p>"
' Placeholder for delete table logic
content &= "<h2>Deletes If Required</h2>"
' serviceClient.DeleteTable(tableName);
content &= "<p>serviceClient.DeleteTable(tableName);</p>"
' Get a client reference to interact with the table
content &= "<h2>Get Table Client</h2>"
Dim tableClient = serviceClient.GetTableClient(tableName)
content &= "<p>var tableClient = serviceClient.GetTableClient(tableName);</p>"
' Define and add a new entity to the table
content &= "<h2>Add Table Entity</h2>"
Dim tableEntity As New TableEntity From {
{ "Book", "Awesome IronPDF Package" },
{ "Price", 5.00 },
{ "Quantity", 21 }
}
tableEntity.PartitionKey = tableEntity("Book").ToString()
tableEntity.RowKey = tableEntity("Price").ToString()
content &= "<p>new TableEntity() { { ""Book"", ""Awesome IronPDF Package"" }, { ""Price"", 5.00 }, { ""Quantity"", 21 } }</p>"
content &= $"<p>tableEntity.PartitionKey = {tableEntity("Book")}</p>"
content &= $"<p>tableEntity.RowKey = {tableEntity("Price")}</p>"
Console.WriteLine($"{tableEntity.RowKey}: {tableEntity("Book")} costs ${tableEntity.GetDouble("Price")}.")
content &= $"<p>{tableEntity.RowKey}: {tableEntity("Book")} costs ${tableEntity.GetDouble("Price")}</p>"
' Add the entity to the table
tableClient.AddEntity(tableEntity)
content &= "<p>Entity added.</p>"
' Query the table
content &= "<h2>Query Table</h2>"
Dim queryResultsFilter As Pageable(Of TableEntity) = tableClient.Query(Of TableEntity)(filter:= $"PartitionKey eq '{tableEntity.PartitionKey}'")
content &= "<p>Using tableClient.Query<TableEntity></p>"
' Iterate and display queried entities
For Each qEntity As TableEntity In queryResultsFilter
content &= $"<p>{qEntity.GetString("Book")}: {qEntity.GetDouble("Price")}</p>"
Console.WriteLine($"{qEntity.GetString("Book")}: {qEntity.GetDouble("Price")}")
Next qEntity
Console.WriteLine($"The query returned {queryResultsFilter.Count()} entities.")
content &= $"<p>The query returned {queryResultsFilter.Count()} entities.</p>"
' Render HTML content as PDF
Dim pdf = renderer.RenderHtmlAsPdf(content)
' Save the PDF to a file
pdf.SaveAs("AwesomeAzureDataTables.pdf")
End Function
End Module
End Namespace
程式碼解釋
程式碼示範如何與 Azure Table Storage 互動,並使用 IronPDF 產生 PDF:
- Azure 表格式儲存互動:
- 它使用 Azure SDK 適用於 .NET (Azure.Data.Tables) 連接到 Azure Table Storage。
- 它會檢查是否存在名為"IronDemo"的表; 如果沒有,它會創建它。
- 在表格中加入新的實體(類似於資料庫行),指定"Book"、"Price"和"Quantity"等屬性。
- 根據篩選條件查詢表格以擷取實體。
2.使用 IronPDF 產生 PDF:
- 使用 IronPDF 的 ChromePdfRenderer 將 HTML 內容渲染為 PDF 檔案。
- 從動態 HTML 內容產生 PDF,其中包含有關 Azure Table Storage 作業的詳細資訊。

IronPDF 授權。
IronPDF 套件需要授權才能執行。 在存取套件之前,在應用程式開始時加入以下程式碼
IronPdf.License.LicenseKey = "IRONPDF-KEY";
IronPdf.License.LicenseKey = "IRONPDF-KEY";
Imports IronPdf
IronPdf.License.LicenseKey = "IRONPDF-KEY"
此處提供試用版授權。
結論
Azure Table Storage 證明 Microsoft 致力於在雲端為開發人員提供可擴充、靈活且具成本效益的資料儲存解決方案。 Azure Table Storage 擁有無模式設計、水平擴充能力,以及與 Azure 生態系統的無縫整合,讓開發人員能夠建立彈性、靈活的應用程式,以適應現代企業環境的動態需求。
無論是管理 IoT 資料流、儲存內容元資料,或是協調分散式系統,Azure Table Storage 都能提供多樣化的平台,充分發揮雲端原生應用程式的潛力。 隨著組織持續接受數位轉型計畫並遷移至雲端,Azure Table Storage 仍是現代資料儲存架構的基石,可推動創新,並讓企業在資料日益驅動的世界中蓬勃發展。
IronPDF是一個 .NET 函式庫,用於以程式化的方式建立和處理 PDF 文件。 它允許開發人員將 HTML、ASPX 頁面、圖片和文字轉換成 PDF 檔案。 主要功能包括 HTML 至 PDF 轉換、PDF 編輯功能,以及支援各種 .NET 環境,使其成為在 .NET 應用程式中產生和處理 PDF 文件的多用途工具。
常見問題解答
如何使用 C# 將 HTML 內容轉換為 PDF?
您可以使用 IronPDF 庫在 C# 中將 HTML 內容轉換為 PDF。該庫提供了如 RenderHtmlAsPdf 這樣的方法以將 HTML 字串或文件轉換為 PDF 文件。
在 Azure Table Storage 中分區扮演什麼角色?
Azure Table Storage 中的分區有助於將數據分佈在不同的節點上,提高負載平衡和可擴展性。它使用分區鍵來在儲存叢集內高效地管理資料。
我能否將 Azure Table Storage 與 C# PDF 庫集成以生成文件?
是的,您可以將 Azure Table Storage 與像 IronPDF 這樣的 C# PDF 庫集成來生成文件。這種整合允許從 Azure Table Storage 提取數據並使用 IronPDF 將其呈現為 PDF 格式。
在雲端數據庫使用無架構儲存的好處是什麼?
Azure Table Storage 提供的無架構儲存,為數據設計提供了靈活性。它允許在同一表內使用不同的數據結構,這便於敏捷開發及適應不斷變化的數據模型。
Azure Table Storage 如何支持 IoT 資料管理?
Azure Table Storage 通過為遙測數據提供可擴展和高效的儲存來支持 IoT 資料管理。其無架構的設計和可擴展性使其成為管理大量 IoT 資料的理想選擇。
在生產環境中使用 C# PDF 庫需要許可嗎?
是的,在生產環境中使用像 IronPDF 這樣的 C# PDF 庫需要許可。為了評估目的,有提供試用許可,允許開發者在購買前探索其功能。
Azure Table Storage 如何確保數據查詢的高效性?
Azure Table Storage 使用包含分區鍵和行鍵的鍵值對模型,優化數據查詢和檢索。這種設計允許高效地訪問大型數據集。
Azure Table Storage 的常見應用是什麼?
Azure Table Storage 常見的應用包括存儲內容管理的元資料、管理 Web 應用中的會話狀態,以及在分佈式系統中協調共享狀態。



