![](/style/images/good.png)
![](/style/images/bad.png)
TableStorageLocal
source link: https://github.com/CraftyFella/TableStorageLocal
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
TableStorageLocal
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)
Docker image
The Azurite example can be run as a docker image:
docker run -d -p 10002:10002 --name tablestoragelocal craftyfella/tablestoragelocal:latest
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK