Dewiride.Azure.Storage.Table.Helper
1.0.7
Prefix Reserved
dotnet add package Dewiride.Azure.Storage.Table.Helper --version 1.0.7
NuGet\Install-Package Dewiride.Azure.Storage.Table.Helper -Version 1.0.7
<PackageReference Include="Dewiride.Azure.Storage.Table.Helper" Version="1.0.7" />
<PackageVersion Include="Dewiride.Azure.Storage.Table.Helper" Version="1.0.7" />
<PackageReference Include="Dewiride.Azure.Storage.Table.Helper" />
paket add Dewiride.Azure.Storage.Table.Helper --version 1.0.7
#r "nuget: Dewiride.Azure.Storage.Table.Helper, 1.0.7"
#:package Dewiride.Azure.Storage.Table.Helper@1.0.7
#addin nuget:?package=Dewiride.Azure.Storage.Table.Helper&version=1.0.7
#tool nuget:?package=Dewiride.Azure.Storage.Table.Helper&version=1.0.7
Dewiride.Azure.Storage.Table.Helper
Dewiride.Azure.Storage.Table.Helper
is a .NET library that provides helper methods and an interface for interacting with Azure Table Storage.
Features
- Retrieve single or multiple entities from Azure Table Storage.
- Query entities by partition key, row key, or email.
- Insert or merge entities into Azure Table Storage.
- Delete entities from Azure Table Storage.
- Easy-to-use asynchronous methods.
Installation
You can install the package via NuGet:
dotnet add package Dewiride.Azure.Storage.Table.Helper
Or via the NuGet Package Manager in Visual Studio.
Usage
Step 1: Configure Dependencies
Ensure you have the necessary NuGet packages installed:
Azure.Data.Tables
Microsoft.Extensions.Logging.Abstractions
Step 2: Create a TableServiceClient
First, create an instance of TableServiceClient
and configure logging.
using Azure.Data.Tables;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
var serviceClient = new TableServiceClient("<Your_Connection_String>");
var logger = NullLogger<TableStorageHelper>.Instance;
Step 3: Initialize the TableStorageHelper
Create an instance of TableStorageHelper
using the TableServiceClient
and ILogger
.
using Azure.Storage.Table.Helper;
var tableStorageHelper = new TableStorageHelper(logger, serviceClient);
Initializing the TableStorageHelper
from a DI container is recommended.
builder.Services.AddAzureClients(clientBuilder =>
{
clientBuilder.AddTableServiceClient(builder.Configuration["ConnectionString"] ?? throw new NullReferenceException("Table Storage not configured."));
});
builder.Services.AddSingleton<ITableStorageHelper, TableStorageHelper>();
Usage in a service:
public class MyService
{
private readonly ITableStorageHelper _tableStorageHelper;
public MyService(ITableStorageHelper tableStorageHelper)
{
_tableStorageHelper = tableStorageHelper;
}
public async Task<MyEntity> GetEntityAsync(string partitionKey, string rowKey)
{
return await _tableStorageHelper.GetEntityAsync<MyEntity>("TableName", partitionKey, rowKey);
}
}
Step 4: Use the Helper Methods
You can now use the helper methods to interact with Azure Table Storage.
Retrieve a Single Entity
var entity = await tableStorageHelper.GetEntityAsync<MyEntity>("TableName", "PartitionKey", "RowKey");
Retrieve Entities by Email
var entity = await tableStorageHelper.GetEntityByEmailAsync<MyEntity>("TableName", "PartitionKey", "email@example.com");
Retrieve All Entities by Partition Key
var entities = await tableStorageHelper.GetEntitiesAsync<MyEntity>("TableName", "PartitionKey");
Insert or Merge an Entity
var entity = new MyEntity
{
PartitionKey = "PartitionKey",
RowKey = "RowKey",
Property = "Value"
};
var response = await tableStorageHelper.UpsertEntityAsync("TableName", entity);
Delete an Entity
var response = await tableStorageHelper.DeleteEntityAsync("TableName", "PartitionKey", "RowKey");
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
Contact
For more information or support, please contact Jagdish Kumawat at support@dewiride.com.
Acknowledgments
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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 was computed. 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. |
-
net8.0
- Azure.Data.Tables (>= 12.10.0)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Upgrade Package.