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: Legacy

ElCamino.AspNet.Identity.AzureTable

Sample Mvc Website

Included in the source is a MVC 5.1 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/samplemvc and the walk-through can be found here Sample Mvc.

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 SampleMvc

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

Remove this using statement throughout the application.

using Microsoft.AspNet.Identity.EntityFramework;

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

Changes to /sample/samplemvc/Models/IdentityModels.cs

Replace the statement

using Microsoft.AspNet.Identity.EntityFramework;

with:

using ElCamino.AspNet.Identity.AzureTable;
using ElCamino.AspNet.Identity.AzureTable.Model;

Inherit from the IdentityUser class to provide the base user information and Azure Table Row and Partition Key mappings.

    // 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
    { ...

Inherit from the IdentityCloudContext which provides the Azure connection and table storage schema.

    public class ApplicationDbContext : IdentityCloudContext<ApplicationUser>
    {
    public ApplicationDbContext() : base() { } ...
Changes to /sample/samplemvc/App_Start/IdentityConfig.cs

Replace the statement

using Microsoft.AspNet.Identity.EntityFramework;

with:

using ElCamino.AspNet.Identity.AzureTable;
using ElCamino.AspNet.Identity.AzureTable.Model;

Adding code to create the azure tables. You can skip this step if you manually create the Azure tables AspNetUsers, AspNetIndex, and AspNetRoles

public class ApplicationUserManager : UserManager<ApplicationUser>
    {
        ...
    /// <summary>
    /// ElCamino - Creates the Azure Table Storage Tables
    /// </summary>
    public static async void StartupAsync()
        {
    var azureStore = new UserStore<ApplicationUser>(new ApplicationDbContext());
            await azureStore.CreateTablesIfNotExists();
        }
...
Changes to /sample/samplemvc/Global.asax.cs

Adding code to create the azure tables. You can skip this step if you manually create the Azure tables AspNetUsers, AspNetIndex, and AspNetRoles

protected void Application_Start()
        {
    //ElCamino - Added to create azure tables
            ApplicationUserManager.StartupAsync();
    //safe to remove after tables are created once.
...
Changes to /sample/samplemvc/Web.config

Remove all references to the EntityFramework.

Add the default local connection string to the Azure Storage Emulator in the configSection - New in 1.2.9.0

<configuration>
<configSections>
    <section name="elcaminoIdentityConfiguration" type="ElCamino.AspNet.Identity.AzureTable.Configuration.IdentityConfigurationSection,ElCamino.AspNet.Identity.AzureTable " />
    </configSections>
    <elcaminoIdentityConfiguration tablePrefix="" storageConnectionString="UseDevelopmentStorage=true" />

Remove the deprecated StorageConnectionString appSetting

...
    <appSettings>
    <!--Remove the deprecated StorageConnectionString appSetting -->    
    <!-- <add key="StorageConnectionString" value="UseDevelopmentStorage=true" />-->
...
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