TableStorage 2.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package TableStorage --version 2.0.0
NuGet\Install-Package TableStorage -Version 2.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="TableStorage" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TableStorage --version 2.0.0
#r "nuget: TableStorage, 2.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.
// Install TableStorage as a Cake Addin
#addin nuget:?package=TableStorage&version=2.0.0

// Install TableStorage as a Cake Tool
#tool nuget:?package=TableStorage&version=2.0.0

TableStorage

Streamlined way of working with Azure Data Tables

Usage

Create your own TableContext

public class MyTableContext : TableContext { }

Create your models, these must be classes, inherit ITableEntity and have a parameterless constructor.

public class Model : ITableEntity
{
    public string PartitionKey { get; set; }
    public string RowKey { get; set; }
    public DateTimeOffset? Timestamp { get; set; }
    public ETag ETag { get; set; }
    
    //Add your own custom properties, e.g:
    public string Data { get; set; }
    public bool Enabled { get; set; }
}

Place your tables on your TableContext. The sample below will create 2 tables in table storage, named Models1 and Models2.

public class MyTableContext : TableContext
{
    public TableSet<Model> Models1 { get; set; }    
    public TableSet<Model> Models2 { get; set; }
}

Optionally, override the Configure method to adjust some configuration options

protected override void Configure(TableOptions options)
{
    options.AutoTimestamps = true;
    options.TableMode = TableUpdateMode.Merge;
}

Register your TableContext in your services

builder.Services.AddTableContext<MyTableContext>(builder.Configuration.GetConnectionString("MyConnectionString"));

Inject MyTableContext into your class and use as needed

public class MyService
{
    private readonly MyTableContext _context;

    public MyService(MyTableContext context)
    {
        _context = context;
    }

    public async Task DoSomething(CancellationToken token)
    {
        var entity = await _context.Models1.GetEntityOrDefaultAsync("partitionKey", "rowKey", token);
        if (entity is not null)
        {
            //Do more
        }
    }
}

Linq

A few simple Linq extension methods have been provided in the TableStorage.Linq namespace.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 was computed.  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. 
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
4.2.1 79 4/23/2024
4.2.0 76 3/18/2024
4.1.0 64 3/15/2024
4.0.0-preview.9 53 3/13/2024
4.0.0-preview.8 45 3/13/2024
4.0.0-preview.7 53 2/8/2024
4.0.0-preview.6 46 2/4/2024
4.0.0-preview.5 55 1/18/2024
4.0.0-preview.4 88 12/6/2023
4.0.0-preview.3 59 12/6/2023
4.0.0-preview.2 102 11/6/2023
4.0.0-preview.1 67 10/11/2023
3.2.0 187 6/8/2023
3.1.0 227 2/26/2023
3.0.0 212 2/26/2023
2.4.1 277 1/12/2023
2.4.0 270 1/12/2023
2.3.1 279 1/11/2023
2.3.0 379 9/8/2022
2.2.0 363 7/25/2022
2.1.0 405 7/17/2022
2.0.0 384 7/17/2022
1.1.0 393 7/16/2022
1.0.0 384 7/16/2022