AzureStorage.Standard.Tables 1.0.0

dotnet add package AzureStorage.Standard.Tables --version 1.0.0
                    
NuGet\Install-Package AzureStorage.Standard.Tables -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AzureStorage.Standard.Tables" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AzureStorage.Standard.Tables" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="AzureStorage.Standard.Tables" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AzureStorage.Standard.Tables --version 1.0.0
                    
#r "nuget: AzureStorage.Standard.Tables, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AzureStorage.Standard.Tables@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AzureStorage.Standard.Tables&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=AzureStorage.Standard.Tables&version=1.0.0
                    
Install as a Cake Tool

AzureStorage.Standard.Tables

A simplified, modern .NET client library for Azure Table Storage with built-in error handling and intuitive APIs for managing tables and entities.

NuGet License: MIT

Features

Simplified API - Easy-to-use wrapper around Azure.Data.Tables SDK Full CRUD Operations - Insert, query, update, and delete entities Table Management - Create, delete, and list tables Flexible Querying - OData filter support for complex queries Batch Transactions - Atomic operations on multiple entities Partition Key Queries - Optimized queries by partition Type-Safe Entities - Generic support for custom entity types Comprehensive Error Handling - Detailed exception information Extensive Documentation - Full XML documentation for IntelliSense

Installation

dotnet add package AzureStorage.Standard.Tables

Or via Package Manager Console:

Install-Package AzureStorage.Standard.Tables

Quick Start

1. Configure the Client

using AzureStorage.Standard.Tables;
using AzureStorage.Standard.Core;

var options = new StorageOptions
{
    ConnectionString = "DefaultEndpointsProtocol=https;AccountName=..."
};

var tableClient = new TableClient(options);

2. Define Your Entity

using AzureStorage.Standard.Core.Domain.Models;

public class Customer : ITableEntity
{
    public string PartitionKey { get; set; }  // e.g., "USA"
    public string RowKey { get; set; }         // e.g., Customer ID
    public DateTimeOffset? Timestamp { get; set; }
    public string ETag { get; set; }

    // Custom properties
    public string Name { get; set; }
    public string Email { get; set; }
    public int Age { get; set; }
}

3. Create a Table

await tableClient.CreateTableIfNotExistsAsync("Customers");

4. Insert an Entity

var customer = new Customer
{
    PartitionKey = "USA",
    RowKey = "customer-001",
    Name = "John Doe",
    Email = "john@example.com",
    Age = 30
};

await tableClient.InsertEntityAsync("Customers", customer);

5. Query Entities

// Get a specific entity
var customer = await tableClient.GetEntityAsync<Customer>(
    tableName: "Customers",
    partitionKey: "USA",
    rowKey: "customer-001"
);

// Query by partition key (efficient!)
var usCustomers = await tableClient.QueryByPartitionKeyAsync<Customer>(
    tableName: "Customers",
    partitionKey: "USA"
);

// Query with OData filter
var filter = "Age gt 25 and Email ne null";
var results = await tableClient.QueryEntitiesAsync<Customer>(
    tableName: "Customers",
    filter: filter
);

6. Update an Entity

customer.Age = 31;
await tableClient.UpdateEntityAsync("Customers", customer);

7. Delete an Entity

await tableClient.DeleteEntityAsync(
    tableName: "Customers",
    partitionKey: "USA",
    rowKey: "customer-001"
);

Advanced Usage

Upsert Operations

// Insert or replace (overwrites all properties)
await tableClient.UpsertEntityAsync("Customers", customer);

Batch Transactions

var actions = new List<TableTransactionAction>
{
    new TableTransactionAction
    {
        ActionType = TableTransactionActionType.Insert,
        Entity = customer1
    },
    new TableTransactionAction
    {
        ActionType = TableTransactionActionType.Update,
        Entity = customer2,
        ETag = "*"
    },
    new TableTransactionAction
    {
        ActionType = TableTransactionActionType.Delete,
        Entity = customer3,
        ETag = "*"
    }
};

// All operations must be in the same partition
await tableClient.ExecuteBatchAsync("Customers", actions);

Optimistic Concurrency with ETags

var customer = await tableClient.GetEntityAsync<Customer>("Customers", "USA", "customer-001");

customer.Age = 32;

// Update only if ETag matches (no concurrent modifications)
await tableClient.UpdateEntityAsync(
    tableName: "Customers",
    entity: customer,
    eTag: customer.ETag  // Will fail if entity was modified by another process
);

Query with Pagination

var results = await tableClient.QueryEntitiesAsync<Customer>(
    tableName: "Customers",
    filter: "Age gt 21",
    maxPerPage: 100  // Limit results per page
);

Get All Entities (Use with Caution)

// Warning: Retrieves ALL entities - use filtering for large tables
var allCustomers = await tableClient.GetAllEntitiesAsync<Customer>("Customers");

Table Management

// List all tables
var tables = await tableClient.ListTablesAsync();

// Check if table exists
bool exists = await tableClient.TableExistsAsync("Customers");

// Delete table
await tableClient.DeleteTableAsync("Customers");

Authentication Options

Connection String (Development)

var options = new StorageOptions
{
    ConnectionString = "DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=..."
};

Account Key

var options = new StorageOptions
{
    AccountName = "myaccount",
    AccountKey = "your-account-key"
};

Service URI (Managed Identity)

var options = new StorageOptions
{
    ServiceUri = new Uri("https://myaccount.table.core.windows.net")
};

Best Practices

1. Partition Key Design

Choose partition keys that distribute data evenly:

// Good: Distributes by country
PartitionKey = "USA"

// Bad: All entities in one partition
PartitionKey = "AllCustomers"

2. Row Key Design

Use unique identifiers:

// Good: Unique customer ID
RowKey = $"customer-{customerId}"

// Good: Timestamp for time-series data
RowKey = DateTime.UtcNow.Ticks.ToString()

3. Query Optimization

Always use partition key when possible:

// Efficient: Queries single partition
var results = await tableClient.QueryByPartitionKeyAsync<Customer>("Customers", "USA");

// Inefficient: Scans all partitions
var results = await tableClient.GetAllEntitiesAsync<Customer>("Customers");

Supported Frameworks

  • .NET Standard 2.0
  • .NET Standard 2.1
  • .NET 7.0
  • .NET 8.0
  • .NET 9.0

Error Handling

try
{
    await tableClient.InsertEntityAsync("Customers", customer);
}
catch (AzureStorageException ex)
{
    Console.WriteLine($"Error: {ex.Message}");
    Console.WriteLine($"Error Code: {ex.ErrorCode}");
    Console.WriteLine($"Status Code: {ex.StatusCode}");
}

Documentation

For complete documentation, visit the GitHub repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

For issues, questions, or suggestions, please open an issue on GitHub.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 33 10/20/2025
0.0.0-alpha.0.11 29 10/20/2025
0.0.0-alpha.0.10 31 10/20/2025
0.0.0-alpha.0.9 29 10/20/2025
0.0.0-alpha.0.8 34 10/19/2025
0.0.0-alpha.0.7 35 10/19/2025
0.0.0-alpha.0.6 34 10/19/2025
0.0.0-alpha.0.5 30 10/19/2025

Initial release v1.0.0:
- Full CRUD operations (Insert, Query, Update, Delete, Upsert)
- Type-safe generic entity support with ITableEntity
- Flexible OData filter queries for complex scenarios
- Partition key queries for optimized performance
- Batch transactions (up to 100 operations per batch)
- Optimistic concurrency with ETag support
- Table management operations (Create, Delete, List, Exists)
- Comprehensive error handling with AzureStorageException
- Async/await pattern throughout
- Extensive XML documentation with examples
- Multi-framework support (.NET Standard 2.0+, .NET 7-9)