mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-20 02:29:24 +08:00
采用全新的数据库架构
This commit is contained in:
@@ -8,6 +8,7 @@ using System.Web.Optimization;
|
||||
using System.Web.Routing;
|
||||
using Autofac;
|
||||
using Autofac.Integration.Mvc;
|
||||
using Infrastructure;
|
||||
using OpenAuth.App;
|
||||
using OpenAuth.Domain.Interface;
|
||||
using OpenAuth.Repository;
|
||||
@@ -18,41 +19,15 @@ namespace OpenAuth.Mvc
|
||||
{
|
||||
protected void Application_Start()
|
||||
{
|
||||
InitAutofac();
|
||||
AutofacExt.InitAutofac();
|
||||
|
||||
|
||||
AreaRegistration.RegisterAllAreas();
|
||||
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
|
||||
RouteConfig.RegisterRoutes(RouteTable.Routes);
|
||||
BundleConfig.RegisterBundles(BundleTable.Bundles);
|
||||
}
|
||||
|
||||
private static void InitAutofac()
|
||||
{
|
||||
var builder = new ContainerBuilder();
|
||||
|
||||
builder.RegisterType<UserRepository>().As<IUserRepository>();
|
||||
builder.RegisterType<LoginApp>();
|
||||
|
||||
// Register your MVC controllers.
|
||||
builder.RegisterControllers(typeof (MvcApplication).Assembly);
|
||||
|
||||
// OPTIONAL: Register model binders that require DI.
|
||||
builder.RegisterModelBinders(Assembly.GetExecutingAssembly());
|
||||
builder.RegisterModelBinderProvider();
|
||||
|
||||
// OPTIONAL: Register web abstractions like HttpContextBase.
|
||||
builder.RegisterModule<AutofacWebTypesModule>();
|
||||
|
||||
// OPTIONAL: Enable property injection in view pages.
|
||||
builder.RegisterSource(new ViewRegistrationSource());
|
||||
|
||||
// OPTIONAL: Enable property injection into action filters.
|
||||
builder.RegisterFilterProvider();
|
||||
|
||||
// Set the dependency resolver to be Autofac.
|
||||
var container = builder.Build();
|
||||
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
|
||||
LogHelper.Log("启动Web");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user