TGC.AzureTableStorage
0.1.2
See the version list below for details.
dotnet add package TGC.AzureTableStorage --version 0.1.2
NuGet\Install-Package TGC.AzureTableStorage -Version 0.1.2
<PackageReference Include="TGC.AzureTableStorage" Version="0.1.2" />
paket add TGC.AzureTableStorage --version 0.1.2
#r "nuget: TGC.AzureTableStorage, 0.1.2"
// Install TGC.AzureTableStorage as a Cake Addin #addin nuget:?package=TGC.AzureTableStorage&version=0.1.2 // Install TGC.AzureTableStorage as a Cake Tool #tool nuget:?package=TGC.AzureTableStorage&version=0.1.2
TGC.AzureTableStorage
Disclaimer: This library is still in alpha and is used on your own risk!
Using the library
Before doing anything code related, you'll need to configure your appsettings.
Create the following section (Ensure naming is correct):
"StorageConfiguration": {
"AccountConnectionString": "DefaultEndpointsProtocol=https;AccountName={StorageAccountName};AccountKey={AccountKey};EndpointSuffix=core.windows.net"
}
In order to use the library you will need to add the following extension methods on your IServiceCollection:
builder.Services.AddAzureTableStorage();
The method above takes care of reading configuration values and setting up context.
The library maps classes to individual tables in the Azure Storage Account. For each table you will need to define a related DTO. The definition requires adding a custom attribute and inherit from a specific class.
An example looks like this:
namespace Your.Namespace;
[TableItem("FooBars")]
internal class FooBarItem : AzureTableItem
{
public string Foo { get; set; }
public string Bar { get; set; }
}
Once your DTO is defined, you will need to register a service for it. That is simply done the on your IServiceProvider as well with the following method:
builder.Services.AddStorageRepository<FooBarItem>();
Now, you can simply use the interface IAzureTableStorageRepository with any of your registered DTOs and your IServiceProvider takes care of the rest:
namespace Your.Namespace;
public class Service
{
private readonly ILogger<Service> _logger;
private readonly IAzureTableStorageRepository<FooBarItem> _azureTableStorageRepository;
public Service(ILogger<Service> log, IAzureTableStorageRepository<FooBarItem> azureTableStorageRepository)
{
_logger = log;
_azureTableStorageRepository = azureTableStorageRepository;
}
}
Patch notes
0.0.3
First alpha-release
0.1.0
Upgraded to .Net 7 and updated readme
0.1.1
Fixed failing unit tests
0.1.2
Added another way of configuring storage context with connectionstring directly
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. 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. |
-
net7.0
- Azure.Data.Tables (>= 12.8.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0.0)
- Microsoft.Extensions.Options (>= 7.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 7.0.0)
- TGC.Configuration (>= 1.0.0)
- TGC.CSharpCodingStandards (>= 1.0.3)
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 |
---|---|---|
0.5.0 | 0 | 12/28/2024 |
0.4.0 | 124 | 4/6/2024 |
0.3.0 | 137 | 3/17/2024 |
0.2.1 | 164 | 7/16/2023 |
0.2.0 | 163 | 7/16/2023 |
0.1.6 | 145 | 6/18/2023 |
0.1.5 | 143 | 5/29/2023 |
0.1.4 | 134 | 5/29/2023 |
0.1.3 | 127 | 5/29/2023 |
0.1.2 | 143 | 5/28/2023 |
0.1.1 | 131 | 5/28/2023 |
0.1.0 | 129 | 5/28/2023 |
0.0.3 | 171 | 4/23/2023 |
0.0.2 | 166 | 4/23/2023 |
0.0.1 | 172 | 4/23/2023 |