EntityTableService 0.1.1-beta.2
Library was partially rewrited to fit with new Azure Storage SDK .Net (v12)
dotnet add package EntityTableService --version 0.1.1-beta.2
NuGet\Install-Package EntityTableService -Version 0.1.1-beta.2
<PackageReference Include="EntityTableService" Version="0.1.1-beta.2" />
paket add EntityTableService --version 0.1.1-beta.2
#r "nuget: EntityTableService, 0.1.1-beta.2"
// Install EntityTableService as a Cake Addin #addin nuget:?package=EntityTableService&version=0.1.1-beta.2&prerelease // Install EntityTableService as a Cake Tool #tool nuget:?package=EntityTableService&version=0.1.1-beta.2&prerelease
EntityTableService
EntityTableService is a part of EntityStorageServices, an experimental set of tools to manage your entities in Azure Storage Cloud services. Specifically, EntityTableService help you to manage pure entities in Azure table storage. It is based on the official Azure storage SDK Client.
This project is focused on entities abstraction and performance.
Features:
- Pure and strongly typed Entity: no explicit dependency with ITableEntity interface
- Custom indexes
- Indexable computed props linked to an Entity
- Custom metadatas per entity
- Lightweight and extensible query expression builder (no dependency with ITableEntity)
- Entity table observers
How it works?
EntityTableClient generate and manage entity projections to store custom indexes. Internally, it use Azure storage ETG feature (entity transaction group) to keep projections synchronized with the main entity.
Sample console
Test project
Remark: Azure emulator required by default
EntityTableClient configuration example
var options = new EntityTableClientOptions(ConnectionString, $"{nameof(PersonEntity)}Table", maxConcurrentInsertionTasks: 10);
var entityClient = EntityTableClient.CreateEntityTableClient<PersonEntity>(options, config =>
{
config
//Partition key could be composed with any string based values
.SetPartitionKey(p => p.AccountId)
//Define an entity prop as primary key
.SetPrimaryKey(p => p.PersonId)
//Add additionnal indexes
.AddIndex(p => p.LastName)
.AddIndex(p => p.Distance)
.AddIndex(p => p.Enabled)
//props couldbe ignored (for both read and write operations)
.AddIgnoredProp(p => p.Created)
//Add computed props, computed on each updates.
.AddComputedProp("_IsInFrance", p => (p.Address.State == "France"))
.AddComputedProp("_MoreThanOneAddress", p => (p.OtherAddress.Count > 1))
.AddComputedProp("_CreatedNext6Month", p => (p.Created > DateTimeOffset.UtcNow.AddMonths(-6)))
.AddComputedProp("_FirstLastName3Chars", p => p.LastName.ToLower().Substring(0, 3))
//Native props values could be overrided by computed props
.AddComputedProp(nameof(PersonEntity.FirstName), p => p.FirstName.ToUpperInvariant())
//Add index for any entity or computed props
.AddIndex("_FirstLastName3Chars");
});
Usage example: Query the Azure storage with entityTableClient
//Query entities with configured primarykey
_ = await entityClient.GetByIdAsync(
person.AccountId,
person.PersonId);
//Query entities with any props
_ = await entityClient.GetAsync(
person.AccountId,
w => w.Where(p => p.LastName).Equal(person.LastName));
//Query entities by indexed prop
_ = await entityClient.GetByAsync(
person.AccountId,
p => p.LastName,
person.LastName);
//Query entities with computed prop
_ = await entityClient.GetAsync(
person.AccountId,
w => w.Where("_FirstLastName3Chars").Equal("arm"));
//Query entities by indexed computed prop
_ = await entityClient.GetByAsync(
person.AccountId,
"_FirstLastName3Chars", "arm");
Sample console projet (600K entities with standard storageV2 account storage)
Generate faked 1000 entities...Ok
Insert 1000 entities...in 2,3804459 seconds
====================================
1. Get By Id 0,048 seconds
2. Get By LastName 1,983 seconds
3. Get By LastName (indexed) 0,1 seconds
4. Get LastName start with 'arm' 2,044 seconds
5. Get by LastName start with 'arm' (indexed) 0,056 seconds
====================================
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 | 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. |
-
.NETStandard 2.1
- Microsoft.Azure.Cosmos.Table (>= 1.0.8)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 3.1.15)
- Polly (>= 7.2.2)
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.1.1-beta.2 | 6,971 | 6/27/2021 | |
0.1.1-beta | 482 | 6/5/2021 | |
0.1.0-preview-23.1 | 246 | 5/31/2021 | |
0.1.0-preview-23 | 191 | 5/31/2021 | |
0.1.0-preview-22 | 176 | 5/24/2021 | |
0.1.0-preview-21.5 | 151 | 5/20/2021 | |
0.1.0-preview-20.1 | 194 | 2/6/2021 | |
0.1.0-preview-19.1 | 275 | 1/8/2021 |