the cloud way

View on GitHub

el camino cloud logoIdentityazuretable

This project provides a high performance cloud solution for ASP.NET Identity Core using Azure Table storage replacing the Entity Framework / MSSQL provider.

Home | Getting Started | Quick Starts | Data Migration | Technical Overviews
Download this project as a .zip file Download this project as a tar.gz file

 

Quick Start: IdentityCore 1.x MVC - No PageModel Scaffolding

ElCamino.AspNetCore.Identity.AzureTable

Sample Mvc6 (.NET Core) Website

Included in the source is a MVC 6 Website project that is an example of removing the EntityFramework and Identity EntityFramework references and replacing them with the Azure Table storage provider. The source of the sample project can be found Source Code /sample/samplemvccore.

Overview

The sample Mvc web application is a standard web application that uses the Individual User Accounts authentication type. The EntityFramework references have been removed and replaced with the Azure Table storage provider.

Walk-Through of the samplemvccore

Remove the NuGet packages EntityFramework and Microsoft.AspNetCore.Identity.EntityFramework packages using the Manage NuGet Packages.

Remove this using statement throughout the application.

using Microsoft.AspNetCore.Identity.EntityFramework;

Add the NuGet package or the assembly ElCamino.AspNetCore.Identity.AzureTable to the web application.

Changes to /sample/samplemvccore/Models/ApplicationUser.cs

Replace the statement

using Microsoft.AspNetCore.Identity.EntityFramework;

with:

using ElCamino.AspNetCore.Identity.AzureTable;
using ElCamino.AspNetCore.Identity.AzureTable.Model;
Changes to /sample/samplemvccore/Data/ApplicationDbContext.cs

Replace the statement

using Microsoft.AspNetCore.Identity.EntityFramework;

with:

    // You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
    public class ApplicationUser : IdentityUser
    { ...
Changes to /sample/samplemvccore/Startup.cs

Replace the statement

using Microsoft.AspNetCore.Identity.EntityFramework;

with:

using ElCamino.AspNetCore.Identity.AzureTable;
using ElCamino.AspNetCore.Identity.AzureTable.Model;

Adding code to inject the Azure table provider into the Identity middleware pipeline and optionally, create the azure tables.

    public class Startup 
    {
        ...
    public void ConfigureServices(IServiceCollection services)
    {
        // Add Elcamino Azure Table Identity services.
        services.AddIdentity()
            .AddAzureTableStores(new Func(() =>
            {
                IdentityConfiguration idconfig = new IdentityConfiguration();
                idconfig.TablePrefix = Configuration.GetSection("IdentityAzureTable:IdentityConfiguration:TablePrefix").Value;
                idconfig.StorageConnectionString = Configuration.GetSection("IdentityAzureTable:IdentityConfiguration:StorageConnectionString").Value;
                idconfig.LocationMode = Configuration.GetSection("IdentityAzureTable:IdentityConfiguration:LocationMode").Value;
                return idconfig;
            }))
            .AddDefaultTokenProviders()
            .CreateAzureTablesIfNotExists(); //can remove after first run;
        services.AddMvc();
        // Add application services        
...
Changes to /sample/samplemvccore/appsettings.json

Remove all references to the EntityFramework.

Add the default local connection string to the Azure Storage Emulator in the appsettings.json. TablePrefix can be left blank, any text here will prefix the Azure table storage names. StorageConnectionString is the Azure table storage connection string. LocationMode can be left empty (defaults to PrimaryOnly). Other storage location modes are listed here and must be used with a RA-GRS storage account if changed from the default.

{
...
    "IdentityAzureTable": {
        "IdentityConfiguration": {
            "TablePrefix": "mvc6"
            "StorageConnectionString": "UseDevelopmentStorage=true;"
            "LocationMode": "PrimaryOnly"
        }
    }...
}
Tip

Don't forget to start your Azure Storage Emulator if running locally.

A blog for modern software development

Subscribe and get the latest blog post in your inbox.

Software as a Service

 
price steady pricing page ad
Price Steady

Customized, Hosted Subscription Pricing Pages Up Quickly With No And Low Code Options.

optic nerve ai cyborg looking into space ad
Optic Nerve AI

No code, first class import/publish with Azure, Google cloud custom vision AI services.

Open Source Projects

 
image
Project Title

Project intro lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cum sociis natoque penatibus et magnis dis parturient montes.

NuGet Badge   NuGet Badge

image
Project Title

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.

NuGet Badge   NuGet Badge

image
Project Title

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.

NuGet Badge

image
Project Title

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.

NuGet Badge