using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web; using Microsoft.AspNet.SignalR; using Microsoft.Owin.Logging; using Owin; using Umbraco.Core.Configuration; using Umbraco.Core.Logging; using Umbraco.Web.SignalR; namespace Umbraco.Web { /// /// Provides general extension methods to IAppBuilder. /// public static class AppBuilderExtensions { /// /// Called at the end of configuring middleware /// /// The app builder. /// /// This could be used for something else in the future - maybe to inform Umbraco that middleware is done/ready, but for /// now this is used to raise the custom event /// /// This is an extension method in case developer entirely replace the UmbracoDefaultOwinStartup class, in which case they will /// need to ensure they call this extension method in their startup class. /// public static void FinalizeMiddlewareConfiguration(this IAppBuilder app) { UmbracoDefaultOwinStartup.OnMiddlewareConfigured(new OwinMiddlewareConfiguredEventArgs(app)); } /// /// Sets the OWIN logger to use Umbraco's logging system. /// /// The app builder. public static void SetUmbracoLoggerFactory(this IAppBuilder app) { app.SetLoggerFactory(new OwinLoggerFactory()); } /// /// Configures SignalR. /// /// The app builder. public static IAppBuilder UseSignalR(this IAppBuilder app) { var umbracoPath = GlobalSettings.UmbracoMvcArea; var signalrPath = HttpRuntime.AppDomainAppVirtualPath + umbracoPath + "/BackOffice/signalr"; return app.MapSignalR(signalrPath, new HubConfiguration { EnableDetailedErrors = true }); } } }