EntityTableService 0.1.1-beta

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

// Install EntityTableService as a Cake Tool
#tool nuget:?package=EntityTableService&version=0.1.1-beta&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

Sample console application

Test project

Tests

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 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. 
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
0.1.1-beta.2 6,951 6/27/2021
0.1.1-beta 476 6/5/2021
0.1.0-preview-23.1 236 5/31/2021
0.1.0-preview-23 183 5/31/2021
0.1.0-preview-22 171 5/24/2021
0.1.0-preview-21.5 146 5/20/2021
0.1.0-preview-20.1 189 2/6/2021
0.1.0-preview-19.1 272 1/8/2021