Skip to content

Instantly share code, notes, and snippets.

@ChuckBryan
Last active August 29, 2015 14:05
Show Gist options
  • Save ChuckBryan/47959f1bc2d1531318f4 to your computer and use it in GitHub Desktop.
Save ChuckBryan/47959f1bc2d1531318f4 to your computer and use it in GitHub Desktop.
MVC Registry for Fail Tracker
public MvcRegistry(Func<IContainer> containerFactory)
{
For<BundleCollection>().Use(BundleTable.Bundles);
For<RouteCollection>().Use(RouteTable.Routes);
For<IIdentity>().Use(() => HttpContext.Current.User.Identity);
For<HttpSessionStateBase>()
.Use(() => new HttpSessionStateWrapper(HttpContext.Current.Session));
For<HttpContextBase>()
.Use(() => new HttpContextWrapper(HttpContext.Current));
For<HttpServerUtilityBase>()
.Use(() => new HttpServerUtilityWrapper(HttpContext.Current.Server));
For<IUserStore<ApplicationUser>>()
.Use<UserStore<ApplicationUser>>();
/*This is a factory to get the DBContext for the Identity*/
For<DbContext>().Use(() => new ApplicationDbContext());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment