Orchard/src/Orchard.Azure/Orchard.Azure.Web/Global.asax.cs
Lombiq 5406b17601 Converting all files stored as CRLF in git to be stored as LF
LF is the git default and all new files are stored as such. Old files from the hg to git conversion however were moved over as CRLF.
2015-12-13 22:21:02 +01:00

57 lines
2.0 KiB
C#

using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Autofac;
using Microsoft.WindowsAzure.ServiceRuntime;
using Microsoft.WindowsAzure.Storage;
using Orchard.Environment;
namespace Orchard.Azure.Web {
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
// visit http://go.microsoft.com/?LinkId=9394801
public class MvcApplication : HttpApplication {
private static IOrchardHost _host;
public static void RegisterRoutes(RouteCollection routes) {
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
}
protected void Application_Start() {
// For information on handling configuration changes
// see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.
RoleEnvironment.Changing += (sender, e) => {
// If a configuration setting is changing
if (e.Changes.Any(change => change is RoleEnvironmentConfigurationSettingChange)) {
// Set e.Cancel to true to restart this role instance
e.Cancel = true;
}
};
RegisterRoutes(RouteTable.Routes);
_host = OrchardStarter.CreateHost(MvcSingletons);
_host.Initialize();
}
protected void Application_BeginRequest() {
Context.Items["originalHttpContext"] = Context;
_host.BeginRequest();
}
protected void Application_EndRequest() {
_host.EndRequest();
}
static void MvcSingletons(ContainerBuilder builder) {
builder.Register(ctx => RouteTable.Routes).SingleInstance();
builder.Register(ctx => ModelBinders.Binders).SingleInstance();
builder.Register(ctx => ViewEngines.Engines).SingleInstance();
}
}
}