Enterprise Framework

Software Solutions in the Enterprise

How To : ASP.NET MVC With Microsoft Identity and Unity Bootstrapper

How To : ASP.NET MVC With Microsoft Identity and Unity Bootstrapper

NEW VERSIONHow To : ASP.NET MVC With Microsoft Identity with GUID ID  and Unity Injection

  1. Add the Unity Bootstrapper for ASP.NET MVC Nuget package from Microsoft.
    1. In your Visual Studio 2013 Solution > right click your web project > click Management NuGet Packages
    2. From the left menu, choose Online > All
    3. In the upper right search box > Search Online (Ctrl + E)  > type Unity bootstrapper for ASP.NET MVC by Microsoft
    4. Select Unity bootstrapper for ASP.NET MVC and choose Install
    5. Click Close after install completes
  2. Modify Web Project/App_Start/UnityConfig.cs
    1. Update the using Namespaces to:

      using System;
      using System.Data.Entity;
      using Microsoft.AspNet.Identity;
      using Microsoft.AspNet.Identity.EntityFramework;
      using Microsoft.Practices.Unity;
      using Microsoft.Practices.Unity.Configuration;
      using MicrosoftIdentity.Controllers;
      using MicrosoftIdentity.Models;
      Update RegisterTypes Method

              public static void RegisterTypes(IUnityContainer container)
                  // NOTE: To load from web.config uncomment the line below. Make sure to add a Microsoft.Practices.Unity.Configuration to the using statements.
                  // container.LoadConfiguration();

                  // TODO: Register your types here
                  container.RegisterType<IUserStore<ApplicationUser>, UserStore<ApplicationUser>>();
                  container.RegisterType<DbContext, ApplicationDbContext>();
                  container.RegisterType<AccountController>(new InjectionConstructor());

ASP.NET MVC with Unity Bootstrapper Source Files:  MicrosoftIdentityWithUnityBootstrapper.zip (2.6MB)

TechEd : Video : Performance Optimize Your ASP.NET Web App by Mads Kristensen Review

Performance Optimize Your ASP.NET Web App by Mads Kristensen

This video is a must watch:

Key highlights are:

  • Revenue Impact of traffic by slowing a website
    • Google study
    • Amazon study
  • Using ASP.NET 4.5, you will automatically get
    • A faster start up time by 30%
    • 30% lower memory use
  • Where to focus to get the biggest gain
    • 13% Back
    • 87% Front
  • Web Developer Checklist
  • Developer Tools
  • Step by Step walk through of changes to improve performance
    • Gzip
      • Enabled by default on IIS 7.5
      • Web.Config Update
        • system.webServer > urlCompression
    • Bundling of multiple CSS files using Web Essentials
      • Right Click Multiple CSS files and click Bundle
    • Setting Expires Header for static content
      • Web.Config Update
        • system.webServer > staticContent > clientCache 
    • Cache busting strategy
      • Querystring Cache busting vs Path Cache busting with Fingerprint
      • Using Url Rewrite to assist on virtual url
    • Javascript Files
      • Bundling of multiple javascript files
      • Minimizr.js
      • Place at the bottom
      • script attributes
        • defer
        • async
    • Minify css & javascript files
    • Image lossless compression
    • Illiminate calls for images by
      • Base64 Data Uri Images
    • Favicon compression
    • Minify the HTML
      • Using a HttpModule to remove Whitespace
    • Caching on the server using Output Caching