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); }
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 ViewEngineResult FindView(ActionContext actionContext, string viewName, string masterName) { return findViewInternal(actionContext, viewName, masterName, true, false); }
public virtual ViewEngineResult FindPartialView(ActionContext actionContext, string partialViewName) { return findViewInternal(actionContext, partialViewName, null /*masterName*/, false, false); }
public SparkViewDescriptor CreateDescriptor(ActionContext actionContext, string viewName, string masterName, bool findDefaultMaster, ICollection<string> searchedLocations) { string targetNamespace = actionContext.ActionNamespace; string actionName = actionContext.RouteData.GetRequiredString("controller"); return DescriptorBuilder.BuildDescriptor( new BuildDescriptorParams( targetNamespace, actionName, viewName, masterName, findDefaultMaster, DescriptorBuilder.GetExtraParameters(actionContext)), searchedLocations); }
private ViewEngineResult FindViewInternal(ActionContext actionContext, string viewName, string masterName, bool findDefaultMaster, bool useCache) { var searchedLocations = new List<string>(); string targetNamespace = actionContext.ActionNamespace; string controllerName = actionContext.RouteData.GetRequiredString("controller"); var descriptorParams = new BuildDescriptorParams( targetNamespace, controllerName, viewName, masterName, findDefaultMaster, DescriptorBuilder.GetExtraParameters(actionContext)); ISparkViewEntry entry; if (useCache) { if (TryGetCacheValue(descriptorParams, out entry) && entry.IsCurrent()) { return BuildResult(actionContext.HttpContext, entry); } return new ViewEngineResult(new List<string> { "Cache" }); } SparkViewDescriptor descriptor = DescriptorBuilder.BuildDescriptor( descriptorParams, searchedLocations); if (descriptor == null) return new ViewEngineResult(searchedLocations); entry = Engine.CreateEntry(descriptor); SetCacheValue(descriptorParams, entry); return BuildResult(actionContext.HttpContext, entry); }
public ISparkView FindView(HttpContextBase httpContext, string actionNamespace, string actionName, string viewName, string masterName) { var routeData = new RouteData(); routeData.Values.Add("controller", actionName.RemoveSuffix("Controller")); var actionContext = new ActionContext(httpContext, routeData, actionNamespace); ViewEngineResult viewResult = FindView(actionContext, viewName, masterName); return viewResult.View; }