フッターコンテンツにスキップ
.NETヘルプ

Azure Tables(開発者向けの仕組み)

クラウドコンピューティングの広大な風景において、データストレージは現代のアプリケーションのアーキテクチャとスケーラビリティを形作る重要な役割を果たします。 Azure Table Storageは、マイクロソフトのAzureによって提供される完全に管理されたNoSQLデータストアで、クラウド内で構造化データを保存するための柔軟なソリューションを開発者に提供します。 Azure Table Storageの機能、使用例、および利点を探る旅に出かけましょう。

Azure Table Storageを理解する

Azure Table Storageは、構造化データをスキーマレスで保存するクラウドベースのNoSQLデータベースサービスです。 Azure Tablesはキーと値のペアに基づいたデータモデルを提供し、各エンティティはパーティションキーと行キーで一意に識別されます。 この設計により、効率的なデータクエリと取得が可能になり、大規模データセットへの素早いアクセスが必要なシナリオに最適です。

構造化データを管理するためにAzure Table Storageとリレーショナルデータベースのどちらを選ぶべきか迷っている場合、Azure Table Storageは大規模データセットを扱う能力とAzureエコシステムとの統合により、開発者のツールキットに便利です。

主要な機能と能力

  1. スキーマレス設計: 従来のリレーショナルデータベースとは異なり、Azure Table Storageはデータに対してスキーマを強制しません。 この柔軟性により、開発者は同じテーブル内で異なる構造のエンティティを保存でき、アジャイル開発を促進し、進化するデータ要件に対応できます。

  2. スケーラビリティとパフォーマンス: Azure Table Storageは、スケーラビリティを重視して設計されており、大量のデータを容易に処理できます。 自動でスケーリングして増加する作業負荷に対応し、予測可能なパフォーマンスを提供するため、高スループットのアプリケーションや低レイテンシーのデータアクセスが求められるシナリオに適しています。

  3. パーティショニングと負荷分散: Azure Table Storageのデータはパーティションキーに基づいてパーティショニングされ、複数のストレージノード間で効率的にデータを分散させます。 このパーティショニング戦略により、水平スケーラビリティと負荷分散が可能になり、最適なパフォーマンスとリソース利用率を確保します。

  4. セカンダリインデックス: Azure Table Storageは主にパーティションキーと行キーをデータ取得に使用しますが、複合キーやクエリ投影を通じてセカンダリインデックスもサポートします。 この機能により、開発者は効率的な範囲クエリを実行したり、セカンダリ属性に基づいてデータをフィルタリングしたりでき、データアクセスパターンの柔軟性が向上します。

  5. Azureエコシステムとの統合: Azure Table StorageはAzure Functions、Azure Cosmos DB、Azure Logic Appsなどの他のAzureサービスとシームレスに統合し、開発者がエンドツーエンドのソリューションを簡単に構築できます。 サーバーレス機能でデータストリームを処理したり、高度な分析ツールでデータを分析したりする際に、Azure Table Storageはスケーラブルで強靭なアプリケーションを構築するための基盤コンポーネントとして機能します。

使用例

Azure Table Storageは多くの業界にわたって幅広く利用できます。使用例は以下の通りです。

  1. モノのインターネット(IoT): Azure Table Storageは、IoTデバイスからのテレメトリデータを保存するのに最適で、リアルタイムのデータ収集、分析、可視化を可能にします。 そのスケーラビリティとパフォーマンスは、IoTデプロイメントによって生成される大規模なデータ量を処理するのに理想的です。

  2. コンテンツ管理: ブログ、記事、ユーザー生成コンテンツなど、コンテンツメタデータを構造化ストレージするアプリケーションのためには、Azure Table Storageは費用対効果が高くスケーラブルなソリューションを提供します。 そのスキーマレス設計は、コンテンツ構造の変化を時間とともに受け入れる柔軟なスキーマ進化を可能にします。

  3. セッション状態管理: Azure Table Storageは、Webアプリケーションのセッション状態データを保存して、分散型でスケーラブルなセッション管理ソリューションを提供します。 セッション状態をAzure Table Storageにオフロードすることで、開発者は負荷分散環境でのスケーラビリティ、フォールトトレランス、セッション親和性を改善できます。

  4. 分散システム: 分散システムのアーキテクチャにおいて、Azure Table Storageは、コンポーネント間の共有状態と調整を維持するための基盤データストアとして機能します。 そのパーティショニングとスケーラビリティの機能により、分散キャッシュ、構成管理、マイクロサービス間の調整が求められるシナリオに最適です。

IronPDFの紹介

Azure Tables (How It Works For Developers): 図1

IronPDFは、.NETプロジェクトでPDFドキュメントの生成、管理、抽出を可能にするC# PDFライブラリです。 以下にいくつかの主要な機能を紹介します:

  1. HTMLからPDFへの変換:

    • HTML、CSS、JavaScriptコンテンツをPDFドキュメントに変換します。
    • 完璧なピクセルでのPDFを実現するChromeレンダリングエンジン。
    • 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 Tablesを使用してPDFドキュメントを生成する

まず、以下のようにVisual Studioを使用してコンソールアプリケーションを作成します。

Azure Tables (How It Works For Developers): 図2

プロジェクト名を入力します。

Azure Tables (How It Works For Developers): 図3

.NETバージョンを提供します。

Azure Tables (How It Works For Developers): 図4

IronPDFパッケージをNuGetパッケージマネージャからインストールします。

Azure Tables (How It Works For Developers): 図5

Azure TablesライブラリにアクセスするためにNuGetパッケージマネージャにあるAzure TablesクライアントライブラリAzure.Data.Tablesを使用します。 Azure Table ServiceクライアントはAzure Table Storageと対話するための機能を提供します。

Azure Tables (How It Works For Developers): 図6

Azure Storageアカウントを作成してAzure Tablesを開始します。

Azure Tables (How It Works For Developers): 図7

確認して作成をクリックします。 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を生成する方法を示しています。

  1. Azure Table Storageとの連携:
    • Azure SDK for .NET (Azure.Data.Tables)を使用してAzure Table Storageに接続します。
    • その後、「IronDemo」という名前のテーブルが存在するかどうかをチェックし、存在しない場合は作成します。 - 属性「Book」、「Price」、「Quantity」などを指定してテーブルに新しいエンティティ(データベースの行に類似)を追加します。
    • フィルタ条件に基づいてエンティティを取得するためにテーブルをクエリします。
  2. IronPDFでのPDF生成:

    • IronPDFのChromePdfRendererを使用してHTMLコンテンツをPDFファイルにレンダリングします。
    • Azure Table Storageの操作についての詳細を含む動的なHTMLコンテンツからPDFを生成します。 Azure Tables (How It Works For Developers): 図8

IronPDFパッケージは実行にライセンスが必要です。

IronPDFライセンス

アプリケーションを開始する前に以下のコードを追加します。 試用ライセンスはこちらで入手可能です。

IronPdf.License.LicenseKey = "IRONPDF-KEY";
IronPdf.License.LicenseKey = "IRONPDF-KEY";
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

Azure Table Storageは、クラウドでのスケーラブルで柔軟かつコスト効率のよいデータストレージソリューションを開発者に提供するためのマイクロソフトのコミットメントを示しています。

結論

そのスキーマレス設計、水平スケーラビリティ、Azureエコシステムとのシームレスな統合により、Azure Table Storageは現代のビジネス環境の動的な要求に適応できる強靭でアジャイルなアプリケーションを構築する力を開発者に与えます。 IoTデータストリームの管理、コンテンツメタデータの保存、分散システムの調整に関係なく、Azure Table Storageはクラウドネイティブアプリケーションの可能性を完全に引き出すための多用途のプラットフォームを提供します。

組織が引き続きデジタルトランスフォーメーションイニシアチブを採用しクラウド移行を進める中で、Azure Table Storageは現代のデータストレージアーキテクチャの基盤として、イノベーションを促進し、データドリブンな世界でビジネスが成功するための支援を続けています。 IronPDFは、PDFドキュメントをプログラムで生成および操作するために使用される.NETライブラリです。

開発者がHTML、ASPXページ、画像、テキストをPDFファイルに変換することができます。 主な機能には、HTMLからPDFへの変換、PDF編集機能、さまざまな.NET環境のサポートが含まれ、.NETアプリケーション内でPDFドキュメントを生成および処理するための多用途のツールです。 Key features include HTML to PDF conversion, PDF editing capabilities, and support for various .NET environments, making it a versatile tool for generating and handling PDF documents within .NET applications.

よくある質問

C# を使って HTML コンテンツを PDF に変換するにはどうすればよいですか?

C# では、IronPDF ライブラリを使用して HTML コンテンツを PDF に変換できます。このライブラリは RenderHtmlAsPdf などのメソッドを提供しており、HTML 文字列やファイルを PDF 文書に変換します。

Azure Table Storage においてパーティショニングはどの役割を果たしますか?

Azure Table Storage のパーティショニングは、データを異なるノードに分散させることで、負荷分散とスケーラビリティを向上させます。パーティションキーを使用して、ストレージクラスター全体でデータを効率的に管理します。

C# PDF ライブラリを使用して文書生成のために Azure Table Storage を統合できますか?

はい、C# PDF ライブラリである IronPDF と Azure Table Storage を統合して文書を生成できます。この統合により、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(Internet of Things)への強い関心を持ち、ハードウェアとソフトウェアの統合方法を模索しています。余暇には、ゲームをしたりDiscordボットを作成したりして、技術に対する愛情と創造性を組み合わせています。