public SparkViewDescriptor CreateDescriptor(ActionContext actionContext, string viewName, string masterName, bool findDefaultMaster, ICollection <string> searchedLocations) { return(DescriptorBuilder.BuildDescriptor( new BuildDescriptorParams( actionContext.ActionNamespace, actionContext.ActionName, viewName, masterName, findDefaultMaster, DescriptorBuilder.GetExtraParameters(actionContext)), searchedLocations)); }
public SparkViewToken GetViewToken(ActionCall call, string actionName, string viewName, LanguageType languageType) { var searchedLocations = new List <string>(); var descriptorParams = new BuildDescriptorParams("", actionName, viewName, String.Empty, false, null); var descriptor = DescriptorBuilder.BuildDescriptor(descriptorParams, searchedLocations); if (descriptor == null) { var errMsg = string.Format("View '{0}' could not be found in any of the following locations: {1}", viewName, string.Join(", ", searchedLocations)); throw new CompilerException(errMsg); } descriptor.Language = languageType; return(new SparkViewToken(call, descriptor, call.Method.Name, viewName)); }
public SparkViewDescriptor CreateDescriptor(string targetNamespace, string controllerName, string viewName, string masterName, bool findDefaultMaster) { var searchedLocations = new List <string>(); var descriptor = DescriptorBuilder.BuildDescriptor( new BuildDescriptorParams( targetNamespace /*areaName*/, controllerName, viewName, masterName, findDefaultMaster, null), searchedLocations); if (descriptor == null) { throw new CompilerException("Unable to find templates at " + string.Join(", ", searchedLocations.ToArray())); } return(descriptor); }
public SparkViewDescriptor CreateDescriptor( ControllerContext controllerContext, string viewName, string masterName, bool findDefaultMaster, ICollection <string> searchedLocations) { var targetNamespace = controllerContext.Controller.GetType().Namespace; var controllerName = controllerContext.RouteData.GetRequiredString("controller"); return(DescriptorBuilder.BuildDescriptor( new BuildDescriptorParams( targetNamespace, controllerName, viewName, masterName, findDefaultMaster, DescriptorBuilder.GetExtraParameters(controllerContext)), searchedLocations)); }
private ViewEngineResult FindViewInternal(ControllerContext controllerContext, string viewName, string masterName, bool findDefaultMaster, bool useCache) { var searchedLocations = new List <string>(); var targetNamespace = controllerContext.Controller.GetType().Namespace; var controllerName = controllerContext.RouteData.GetRequiredString("controller"); var descriptorParams = new BuildDescriptorParams( targetNamespace, controllerName, viewName, masterName, findDefaultMaster, DescriptorBuilder.GetExtraParameters(controllerContext)); ISparkViewEntry entry; if (useCache) { if (TryGetCacheValue(descriptorParams, out entry) && entry.IsCurrent()) { return(BuildResult(controllerContext.RequestContext, entry)); } return(_cacheMissResult); } var descriptor = DescriptorBuilder.BuildDescriptor( descriptorParams, searchedLocations); if (descriptor == null) { return(new ViewEngineResult(searchedLocations)); } entry = Engine.CreateEntry(descriptor); SetCacheValue(descriptorParams, entry); return(BuildResult(controllerContext.RequestContext, entry)); }
private ViewEngineResult findViewInternal(ActionContext actionContext, string viewName, string masterName, bool findDefaultMaster, bool useCache) { var searchedLocations = new List <string>(); var targetNamespace = actionContext.ActionNamespace; var descriptorParams = new BuildDescriptorParams( targetNamespace, actionContext.ActionName, viewName, masterName, findDefaultMaster, DescriptorBuilder.GetExtraParameters(actionContext)); ISparkViewEntry entry; if (useCache) { if (tryGetCacheValue(descriptorParams, out entry) && entry.IsCurrent()) { return(buildResult(entry)); } return(new ViewEngineResult(new List <string> { "Cache" })); } var descriptor = DescriptorBuilder.BuildDescriptor(descriptorParams, searchedLocations); if (descriptor == null) { return(new ViewEngineResult(searchedLocations)); } entry = Engine.CreateEntry(descriptor); setCacheValue(descriptorParams, entry); return(buildResult(entry)); }
private ViewEngineResult FindViewInternal(ActionContext actionContext, string viewName, string masterName, bool findDefaultMaster, bool useCache) { var searchedLocations = new List <string>(); var viewPath = actionContext.ViewPath; var descriptorParams = new BuildDescriptorParams( viewPath, viewName, masterName, findDefaultMaster, DescriptorBuilder.GetExtraParameters(actionContext)); ISparkViewEntry entry; if (useCache) { if (TryGetCacheValue(descriptorParams, out entry) && entry.IsCurrent()) { return(BuildResult(actionContext.HttpContext, entry)); } return(cacheMissResult); } var descriptor = DescriptorBuilder.BuildDescriptor( descriptorParams, searchedLocations); if (descriptor == null) { return(new ViewEngineResult(searchedLocations)); } entry = Engine.CreateEntry(descriptor); this.SetCacheValue(descriptorParams, entry); return(BuildResult(actionContext.HttpContext, entry)); }