.NET幫助 Azure Tables(對開發者如何理解的工作) Curtis Chau 更新日期:6月 22, 2025 Download IronPDF NuGet 下載 DLL 下載 Windows 安裝程式 Start Free Trial Copy for LLMs Copy for LLMs Copy page as Markdown for LLMs Open in ChatGPT Ask ChatGPT about this page Open in Gemini Ask Gemini about this page Open in Grok Ask Grok about this page Open in Perplexity Ask Perplexity about this page Share Share on Facebook Share on X (Twitter) Share on LinkedIn Copy URL Email article 在雲端運算的廣大領域中,數據儲存對於塑造現代應用程式的架構和可擴展性具有關鍵作用。 Azure Table Storage 是由 Microsoft Azure 提供的全管理 NoSQL 數據存儲,為開發者提供了一個多功能的解決方案,用於在雲中存儲結構化數據。 讓我們開始探索 Azure Table Storage 的功能、使用案例和優勢。 了解 Azure Table Storage Azure Table Storage 是一種基於雲端的 NoSQL 資料庫服務,提供無模式的結構化數據存儲。 Azure Tables 提供基於鍵值對的數據模型,其中每個實體由分區鍵和行鍵唯一識別。 這種設計使得數據查詢和檢索高效,非常適用於需要快速訪問大量數據集的場景。 如果你在決定使用 Azure Table Storage 還是關係型數據庫來管理你的結構化數據,Azure Table Storage 處理大數據集的能力以及與 Azure 生態系統的集成使其成為開發者工具箱中的一個方便選擇。 關鍵功能和能力 無模式設計: 與傳統的關係型數據庫不同,Azure Table Storage 不對數據施加模式限制。 這種靈活性允許開發者在同一個表中儲存具有不同結構的實體,促進敏捷開發並適應不斷變化的數據需求。 可擴展性和性能: Azure Table Storage 專為可擴展性而設計,能夠輕鬆處理海量數據。 它會自動擴展以適應不斷增加的工作負載,並提供可預測的性能,非常適合高吞吐量應用和要求低延遲數據訪問的場景。 分區和負載均衡: Azure Table Storage 中的數據根據分區鍵進行分區,允許在多個儲存節點之間高效地分配數據。 這種分區策略實現了水平擴展和負載均衡,確保最佳性能和資源利用。 次級索引: 雖然 Azure Table Storage 主要使用分區鍵和行鍵進行數據檢索,但它也支持通過使用合成鍵和查詢投影來實現次級索引。 這一功能使開發者能夠執行高效的範圍查詢,並根據次要屬性篩選數據,增強了數據訪問模式的靈活性。 與 Azure 生態系統集成: Azure Table Storage 與其他 Azure 服務無縫集成,如 Azure Functions、Azure Cosmos DB 和 Azure Logic Apps,使開發者能夠輕鬆構建端到端的解決方案。 無論是使用無伺服器功能處理數據流,還是使用先進分析工具分析數據,Azure Table Storage 作為構建可擴展和高韌性應用程式的基礎組件。 使用案例 Azure Table Storage 滿足不同行業的廣泛應用案例,包括: 物聯網 (IoT): Azure Table Storage 非常適合儲存來自 IoT 設備的遙測數據,支持實時數據攝取、分析和可視化。 其可擴展性和性能使其非常適合處理 IoT 部署產生的大量數據。 內容管理: 對於需要結構化存儲內容元數據的應用程式,如部落格、文章和用戶生成內容,Azure Table Storage 提供了一個成本效益高且可擴展的解決方案。 其無模式設計允許靈活的模式演化,適應隨時間變化的內容結構。 會話狀態管理: 可以使用 Azure Table Storage 儲存 web 應用程序的會話狀態數據,提供分布式和可擴展的會話管理解決方案。 通過將會話狀態卸載到 Azure Table Storage,開發者可以在負載均衡環境中實現更高的可擴展性、容錯性和會話親和性。 分布式系統: 在分布式系統架構中,Azure Table Storage 作為維持共享狀態和組件間協調的基礎數據存儲。 其分區和可擴展性特點使其非常適合需要分布式快取、配置管理和微服務協調的場景。 IronPDF 简介 IronPDF 是一個 C# PDF 庫,可以在 .NET 項目中生成、管理和提取 PDF 文檔的內容。 以下是一些關鍵功能: HTML 到 PDF 轉換: 將 HTML、CSS 和 JavaScript 內容轉換為 PDF 文檔。 Chrome 渲染引擎生成像素完美的 PDF。 從 URL、HTML 文件或 HTML 字符串生成 PDF。 圖像和內容轉換: 將圖像轉換至和從 PDF。 從現有 PDF 文檔中提取文本和圖像。 支持如 JPG、PNG 等各種圖像格式。 編輯和操縱: 設置 PDF 的屬性、安全性和權限。 添加數字簽名。 編輯元數據和修訂歷史。 跨平台支持: 支持 .NET Core (8, 7, 6, 5, 和 3.1+)、.NET Standard (2.0+) 和 .NET Framework (4.6.2+)。 與 Windows、Linux 和 macOS 兼容。 可在 NuGet 上獲得,方便安裝。 使用 IronPDF 和 Azure Tables 生成 PDF 文檔 首先,使用 Visual Studio 創建一個控制台應用程式,如下所示: 提供專案名稱: 提供 .NET 版本: 從 NuGet 包管理器安裝 IronPDF 包: 為了訪問 Azure Tables 庫,我們將使用在 NuGet 包管理器中找到的 Azure Tables 客戶端庫,稱為 Azure.Data.Tables。 Azure 表服務客戶端提供與 Azure Table Storage 互動的功能。 創建一個 Azure 儲存帳戶以啟動 Azure Tables: 單擊審核並創建。 在您的程序中輸入以下代碼,使用 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 $vbLabelText $csharpLabel 代碼說明 該代碼展示了如何與 Azure Table Storage 互動並使用 IronPDF 生成 PDF: Azure Table Storage 互動: 它使用 .NET 的 Azure SDK (Azure.Data.Tables) 連接到 Azure Table Storage。 然後檢查是否存在名為 "IronDemo" 的表; 如果不存在,則創建它。 向表中添加新實體(類似於數據庫行),指定 "Book"、"Price" 和 "Quantity" 等屬性。 根據過濾條件查詢表以檢索實體。 使用 IronPDF 生成 PDF: 使用 IronPDF 的 ChromePdfRenderer 將 HTML 內容渲染為 PDF 文件。 從包括 Azure Table Storage 操作細節的動態 HTML 內容生成 PDF。 IronPDF 許可證 IronPDF 包需要許可證才能運行。 在應用程序開始時在包未被訪問前添加以下代碼。 IronPdf.License.LicenseKey = "IRONPDF-KEY"; IronPdf.License.LicenseKey = "IRONPDF-KEY"; IRON VB CONVERTER ERROR developers@ironsoftware.com $vbLabelText $csharpLabel 可以在此處獲得試用許可證。 結論 Azure Table Storage 是 Microsoft 對開發者提供可擴展、靈活和經濟儲存雲端數據解決方案的承諾的有力證明。 憑藉其無模式設計,水平擴展性和與 Azure 生態系統的無縫集成,Azure Table Storage 使開發者能夠構建強大的、敏捷的應用程序,以適應現代商業環境的動態需求。 無論是管理 IoT 數據流、儲存內容元數據還是協調分布式系統,Azure Table Storage 都提供了一個多功能的平台,幫助充分發揮雲原生應用程序的潛力。 隨著企業不斷推進數字化轉型並遷移到雲端,Azure Table Storage 依然是現代數據儲存架構的基石,推動創新並使企業能夠在日益數據驅動的世界中蓬勃發展。 IronPDF 是用於以編程方式創建和操作 PDF 文檔的 .NET 庫。 它允許開發者將 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 應用中的會話狀態,以及在分佈式系統中協調共享狀態。 Curtis Chau 立即與工程團隊聊天 技術作家 Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。除了開發之外,Curtis 對物聯網 (IoT) 有著濃厚的興趣,探索將硬體和軟體結合的創新方式。在閒暇時間,他喜愛遊戲並構建 Discord 機器人,結合科技與創意的樂趣。 相關文章 更新日期 9月 4, 2025 RandomNumberGenerator C# 使用RandomNumberGenerator C#類可以幫助將您的PDF生成和編輯項目提升至新水準 閱讀更多 更新日期 9月 4, 2025 C#字符串等於(它如何對開發者起作用) 當結合使用強大的PDF庫IronPDF時,開關模式匹配可以讓您構建更智能、更清晰的邏輯來進行文檔處理 閱讀更多 更新日期 8月 5, 2025 C#開關模式匹配(對開發者來說是如何工作的) 當結合使用強大的PDF庫IronPDF時,開關模式匹配可以讓您構建更智能、更清晰的邏輯來進行文檔處理 閱讀更多 C#取模(對開發者如何理解的工作)C# ConfigureAwait(對開發者如...