/// <summary>Analyzes views in the controllers's view folder looking for dynamic template registrations.</summary> /// <typeparam name="T">The type of controller to analyze.</typeparam> /// <param name="engine">The engine from which to resolve the <see cref="ViewTemplateRegistrator"/>.</param> /// <param name="viewFileExtension">The type of view file to analyze. By the default .cshtml files are analyzed.</param> /// <returns>The singleton <see cref="ViewTemplateRegistrator"/> instance.</returns> public ViewTemplateRegistrator Add <T>(string viewFileExtension) where T : IController { var controllerType = typeof(T); string controllerName = controllerType.Name.Substring(0, controllerType.Name.Length - "Controller".Length); Type modelType = typeof(ContentItem); Type contentControllerType = Utility.GetBaseTypes(controllerType).FirstOrDefault(t => t.IsGenericType && t.GetGenericTypeDefinition() == typeof(ContentController <>)); if (contentControllerType != null) { modelType = contentControllerType.GetGenericArguments().First(); } var source = new ViewTemplateSource { ControllerName = controllerName, ModelType = modelType, ViewFileExtension = viewFileExtension }; logger.DebugFormat("Enqueuing view template for controller {0} with model {1} looking for extension {2}", controllerName, modelType, viewFileExtension); QueuedRegistrations.Enqueue(source); if (RegistrationAdded != null) { RegistrationAdded.Invoke(this, new EventArgs()); } return(this); }
private void RaiseRegistrationAdded(IWampProcedureRegistration registration) { RegistrationAdded?.Invoke(this, new WampProcedureRegisterEventArgs(registration)); }
private void RaiseRegistrationAdded(WampProcedureRegisterEventArgs e) { RegistrationAdded?.Invoke(this, e); }