TableStorage 4.3.0
See the version list below for details.
dotnet add package TableStorage --version 4.3.0
NuGet\Install-Package TableStorage -Version 4.3.0
<PackageReference Include="TableStorage" Version="4.3.0" />
paket add TableStorage --version 4.3.0
#r "nuget: TableStorage, 4.3.0"
// Install TableStorage as a Cake Addin #addin nuget:?package=TableStorage&version=4.3.0 // Install TableStorage as a Cake Tool #tool nuget:?package=TableStorage&version=4.3.0
TableStorage
Streamlined way of working with Azure Data Tables
Installation
dotnet add package TableStorage
Usage
Create your own TableContext and mark it with the [TableContext]
attribute. This class must be partial.
[TableContext]
public partial class MyTableContext;
Create your models, these must be classes and have a parameterless constructor. Mark them with the [TableSet]
attribute. This class must be partial.
[TableSet]
public partial class Model
{
public string Data { get; set; }
public bool Enabled { get; set; }
}
Properties can also be defined using the [TableSetProperty]
attribute.
This is particularly useful if you are planning on using dotnet 8+'s Native AOT, as the source generation will make sure any breaking reflection calls are avoided by the Azure.Core libraries.
[TableSet]
[TableSetProperty(typeof(string), "Data")]
[TableSetProperty(typeof(bool), "Enabled")]
public partial class Model;
Some times it's also nice to have a pretty name for your PartitionKey
and RowKey
properties, as the original names might not always make much sense when reading your code, at least not in a functional way.
You can use the [PartitionKeyAttribute]
and [RowKeyAttribute]
attributes to create a proxy for these two properties.
[TableSet]
[PartitionKey("MyPrettyPartitionKey")]
[RowKey("MyPrettyRowKey")]
public partial class Model;
Place your tables on your TableContext. The sample below will create 2 tables in table storage, named Models1 and Models2.
[TableContext]
public partial class MyTableContext
{
public TableSet<Model> Models1 { get; set; }
public TableSet<Model> Models2 { get; set; }
}
Register your TableContext in your services. An extension method will be available specifically for your context.
builder.Services.AddMyTableContext(builder.Configuration.GetConnectionString("MyConnectionString"));
Optionally, pass along a Configure
method to adjust some configuration options.
builder.Services.AddMyTableContext(builder.Configuration.GetConnectionString("MyConnectionString"), Configure);
static void Configure(TableOptions options)
{
options.AutoTimestamps = true;
options.TableMode = TableUpdateMode.Merge;
}
Inject MyTableContext
into your class and use as needed.
public class MyService(MyTableContext context)
{
private readonly MyTableContext _context = context;
public async Task DoSomething(CancellationToken token)
{
var entity = await _context.Models1.GetEntityOrDefaultAsync("partitionKey", "rowKey", token);
if (entity is not null)
{
//Do more
}
}
}
For some special cases, your table name might not be known at compile time. To handle those, an extension method has been added:
var tableSet = context.GetTableSet<Model>("randomname");
Linq
A few simple Linq extension methods have been provided in the TableStorage.Linq
namespace that optimize some existing LINQ methods specifically for Table Storage.
Since these return an instance that implements IAsyncEnumerable
, System.Linq.Async
is an excellent companion to these methods. Do keep in mind that as soon as you start using IAsyncEnumerable
, any further operations will run client-side.
Note: Select
will include the actual transformation. If you want the original model, with only the selected fields retrieved, use SelectFields
instead.
If you are using Native AOT, you will need to use SelectFields
as Select
will not work.
Product | Versions 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 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Azure.Data.Tables (>= 12.8.3)
- FastExpressionCompiler (>= 4.0.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 3.1.0)
- Microsoft.Extensions.DependencyInjection (>= 3.1.0)
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.6.0 | 79 | 11/18/2024 |
4.5.0 | 73 | 11/12/2024 |
4.3.0 | 68 | 7/25/2024 |
4.2.2 | 67 | 7/25/2024 |
4.2.1 | 122 | 4/23/2024 |
4.2.0 | 103 | 3/18/2024 |
4.1.0 | 91 | 3/15/2024 |
4.0.0-preview.9 | 67 | 3/13/2024 |
4.0.0-preview.8 | 65 | 3/13/2024 |
4.0.0-preview.7 | 71 | 2/8/2024 |
4.0.0-preview.6 | 73 | 2/4/2024 |
4.0.0-preview.5 | 69 | 1/18/2024 |
4.0.0-preview.4 | 109 | 12/6/2023 |
4.0.0-preview.3 | 84 | 12/6/2023 |
4.0.0-preview.2 | 135 | 11/6/2023 |
4.0.0-preview.1 | 90 | 10/11/2023 |
3.2.0 | 221 | 6/8/2023 |
3.1.0 | 248 | 2/26/2023 |
3.0.0 | 231 | 2/26/2023 |
2.4.1 | 290 | 1/12/2023 |
2.4.0 | 289 | 1/12/2023 |
2.3.1 | 292 | 1/11/2023 |
2.3.0 | 394 | 9/8/2022 |
2.2.0 | 378 | 7/25/2022 |
2.1.0 | 420 | 7/17/2022 |
2.0.0 | 415 | 7/17/2022 |
1.1.0 | 409 | 7/16/2022 |
1.0.0 | 410 | 7/16/2022 |