Ronhaland.TableContext 0.1.3-alpha2

Suggested Alternatives

Ronhaland.TableWorm 0.2.0-alpha1

Additional Details

Replaced by Ronhaland.TableWorm

This is a prerelease version of Ronhaland.TableContext.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package Ronhaland.TableContext --version 0.1.3-alpha2
                    
NuGet\Install-Package Ronhaland.TableContext -Version 0.1.3-alpha2
                    
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="Ronhaland.TableContext" Version="0.1.3-alpha2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ronhaland.TableContext" Version="0.1.3-alpha2" />
                    
Directory.Packages.props
<PackageReference Include="Ronhaland.TableContext" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Ronhaland.TableContext --version 0.1.3-alpha2
                    
#r "nuget: Ronhaland.TableContext, 0.1.3-alpha2"
                    
#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.
#:package Ronhaland.TableContext@0.1.3-alpha2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Ronhaland.TableContext&version=0.1.3-alpha2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Ronhaland.TableContext&version=0.1.3-alpha2&prerelease
                    
Install as a Cake Tool

TableContext

Library for interacting with azure storage account tables in a relational way.

Setup:

var tableContext = new TableContext();
tableContext
    .ConfigureConnectionString("Connstr") // or .ConfigureTokenCredential()
    .RegisterTable<Root>() // Register all Models
    .RegisterTable<Base>()
    .RegisterTable<Trunk>()
    .RegisterTable<Branch>()
    .RegisterTable<Leaf>();

Models must inherit from the TableModel class.

  • The TableForeignKey Attribute is used to genererate a foreignkey field when saving and reading the table.
  • The TableComboKey Attribute makes the child-object's partitionkey a combination of this objects partitionKey and Id (RowKey).
  • The TableIgnore Attribute is used to ignore a property when saving and reading from the table.
  • The TableParent Attribute tries to set the property to the parent of this object.
  • The TableJson Attribute is used to serialize/deserialize the value as json when reading and writing to the table.

Example:

public class Root : TableModel
{
    [TableForeignKey("MyCustomBaseId")]
    public required Base Base { get; set; }
    public double SomeNumber { get; set; }
    public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow;
    [TableIgnore]
    public List<Branch> Branches { get; set; } = [];
}

public class Base : TableModel
{
    [TableComboKey]
    public List<Branch> Branches { get; set; } = [];
    [TableParent]
    public Root? Root { get; set; }
}

public class Branch : TableModel
{
    [TableParent]
    public Base? Base { get; set; }
}

To save/query/delete:

var allTrees = await tableContext.QueryAsync<Root>(""); //Returns IEnumerable
var myTree = await tableContext.QueryAsync<Root>("RowKey eq 'myTree'"); //Returns IEnumerable
await tableContext.Save(newTree);
await tableContext.Save(manyNewTrees); //Array
await tableContext.Delete(badTree);
await tableContext.Delete(allBadTrees); //Array
Product 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. 
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