Azure Table Storage in ASP.NET Core 2.0

Problem

How to use Azure Table Storage in ASP.NET Core.

Solution

Create a class library and add NuGet package: WindowsAzure.Storage

Add a class to encapsulate settings:

Add a class to encapsulate storage access. Add a private helper method to access storage:

Now add public methods for the storage:

Inject and use storage:

In ASP.NET Core Web Application, configure services:

Discussion

The sample code will require you to setup Azure account, storage account and table. Instructions for these could be found at: https://docs.microsoft.com/en-gb/azure/storage/storage-create-storage-account#create-a-storage-account

Source Code

GitHub: https://github.com/TahirNaushad/Fiver.Azure.Table

Leave a Reply