Skip to content

Latest commit

 

History

History
41 lines (30 loc) · 1.88 KB

README.md

File metadata and controls

41 lines (30 loc) · 1.88 KB

TableStorageLocal

NuGet Version Build

TableStorageLocal is an Azure Table Storage compatible emulator, like Azurite, but built using .NET and the awesome LiteDB so it can run in memory with your tests, or as a standalone process/Docker container if you need to persist your data.

Getting Started

Create a LocalTables instance then use the ConnectionString property to create a CloudTableClient

var tables = new LocalTables();
var client = CloudStorageAccount.Parse(tables.ConnectionString).CreateCloudTableClient();
var table = client.GetTableReference("test");
table.CreateIfNotExists();
var entity = new DynamicTableEntity("PK", "RK", "*", new Dictionary<string, EntityProperty>() { { "Message", EntityProperty.GeneratePropertyForString("Hello, World!") } });
table.Execute(TableOperation.Insert(entity));
var result = table.Execute(TableOperation.Retrieve("PK", "RK"));
Console.WriteLine(((DynamicTableEntity)result.Result).Properties["Message"]);

Use a LiteDB connection string to enable persistance:

var tables = new LocalTables("mydata.db")

Combine this with the default local storage port, and you can browse and edit your data using Azure Storage Explorer

var tables = new LocalTables("mydata.db", 10002)

Storage Explorer

Docker image

The Azurite example can be run as a docker image:

docker run -d -p 10002:10002  --name tablestoragelocal craftyfella/tablestoragelocal:latest