Azure Table Storage DI
Using Azure Table Storage is a very cost effective way to run a cloud hosted database in Microsoft Azure. The question is, how to we manage the DI.
We've of course all heard of Autofac, so I won't explain the benefits of their framework.
- Create our data model.
- Create our CRUD repository and inject an Azure CloudTable into the constructor.
- Create our CRUD service layer and inject the repository into the constructor.
- Implement a module to configure Azure Table Storage using Autofac's DI layer, in four steps -
1) Create an Azure Storage Account:
2) Configure our service layer and our Azure Cloud Table:
3) Configure our repository to use our Azure Cloud Table:
- Configure Startup.cs file to use the Azure Table Storage Autofac module we've built.
- Configure Program.cs file to use Autofac.
- Utilise our CRUD service at the controller level in ASP.Net MVC Core 3.0.
- View our Azure Table Storage NoSQL database to verify our implementation.
Download Github Code Sample
Feel free to DOWNLOAD the sample code of the aforementioned implementation from my Github account.