/// <summary>
        /// Initializes a new instance of the <see cref="MvcHostedApplicationRegistration"/> class.
        /// </summary>
        /// <param name="identifier">The name used to identify the Hosted Module.</param>
        /// <param name="mvcModuleAssembly">The <see cref="Assembly"/> associated to the Hosted Module.</param>
        public MvcHostedApplicationRegistration(IHostedApplication hostedApplication, RouteCollection routeCollection)
            : base()
        {
            if (hostedApplication.IsInvalid())
                throw new InvalidOperationException("The Hosted Application is not correctly configured.");

            this.HostedApplication = hostedApplication;
            this.ModuleAssembly = hostedApplication.ApplicationContextType.Assembly;
            this.PathProvider = new EmbeddedViewVirtualPathProvider(this.Identifier, this.ModuleAssembly);
            HostingEnvironment.RegisterVirtualPathProvider(this.PathProvider);
            this.ModuleAssembly.RegisterControllers(routeCollection, hostedApplication.Identifier);
            ApplicationHostConfiguration.Instance.AddHostedApplication(this.HostedApplication);
        }