public override void Render(string requesterUniqueID) { Basics.Domain.IDomain instance = null; InstanceRequested?.Invoke(ref instance); this._IDAccessTree = instance.IDAccessTree; this._CacheID = CacheObject.ProvideUniqueCacheID(this, ref instance); CacheObject cacheObject = null; CachePool.Current.Get(this._IDAccessTree, this._CacheID, out cacheObject); if (cacheObject != null) { this.RenderedValue = cacheObject.Content; return; } Global.ContentDescription contentDescription = new Global.ContentDescription(this.Value); string blockContent = contentDescription.Parts[0]; this.Parse(blockContent); base.Render(requesterUniqueID); }
private void RenderDomainContents() { Basics.Domain.IDomain instance = null; InstanceRequested?.Invoke(ref instance); this.RenderedValue = instance.ContentsVirtualPath; this.ObjectResult = (object)this.RenderedValue; }
public static string CreateUniqueCacheId(Guid resultId, Control control, ref Basics.Domain.IDomain instance) { if (control == null) { throw new ArgumentNullException(nameof(control)); } if (string.IsNullOrEmpty(instance.Languages.Current.Info.Id) || string.IsNullOrEmpty(control.TemplateTree) || Equals(resultId, Guid.Empty)) { throw new Exceptions.ParseException(); } return($"{instance.Languages.Current.Info.Id}_{control.TemplateTree}_{resultId}"); }
public override void Build() { base.Build(); Basics.Domain.IDomain instance = null; InstanceRequested?.Invoke(ref instance); string renderedValue = this.RenderedValue; this.ExtractSubDirectives(ref renderedValue); if (!this._Cache && string.IsNullOrEmpty(renderedValue)) { throw new Exception.EmptyBlockException(); } object methodResultInfo = Manager.AssemblyCore.ExecuteStatement(instance.IDAccessTree, this.ControlID, renderedValue, this.RenderParameters(), this._Cache); if (methodResultInfo != null && methodResultInfo is System.Exception) { throw new Exception.ExecutionException(((System.Exception)methodResultInfo).Message, ((System.Exception)methodResultInfo).InnerException); } if (methodResultInfo != null) { string renderResult = string.Empty; if (methodResultInfo is Basics.ControlResult.RedirectOrder) { Helpers.Context.AddOrUpdate("RedirectLocation", ((Basics.ControlResult.RedirectOrder)methodResultInfo).Location); } else { renderResult = Manager.AssemblyCore.GetPrimitiveValue(methodResultInfo); } this.RenderedValue = renderResult; return; } this.RenderedValue = string.Empty; }
public static string ProvideUniqueCacheID(PartialCache partialCache, ref Basics.Domain.IDomain instance) { if (partialCache == null) { throw new NullReferenceException("PartialCache Parameter must not be null!"); } string serviceFullPath = string.Empty; IController workingObject = partialCache.Parent; do { if (workingObject is Template) { serviceFullPath = ((Template)workingObject).ControlID; break; } workingObject = workingObject.Parent; } while (workingObject != null); int positionID = -1; Match matchMI = CacheObject._PositionRegEx.Match(partialCache.Value); if (matchMI.Success) { int.TryParse(matchMI.Result("${PositionID}"), out positionID); } if (string.IsNullOrEmpty(instance.Languages.Current.Info.ID) || string.IsNullOrEmpty(serviceFullPath) || positionID == -1) { throw new Exception.ParseException(); } return(string.Format("{0}_{1}_{2}", instance.Languages.Current.Info.ID, serviceFullPath, positionID)); }
private static ControlSettings GetControlSettings(string controlID, ControlResolveHandler controlResolveRequested) { Basics.Domain.IDomain workingInstance = null; do { ControlSettings controlSettings = null; controlResolveRequested?.Invoke(controlID, ref workingInstance, out controlSettings); if (controlSettings != null) { return(controlSettings); } if (workingInstance == null) { return(null); } workingInstance = workingInstance.Parent; } while (workingInstance != null); return(null); }
public static string CreateUniqueCacheId(int positionId, string cacheIdExtension, PartialCache partialCache, ref Basics.Domain.IDomain instance) { if (partialCache == null) { throw new ArgumentNullException(nameof(partialCache)); } if (string.IsNullOrEmpty(instance.Languages.Current.Info.Id) || string.IsNullOrEmpty(partialCache.TemplateTree) || positionId == -1) { throw new Exceptions.ParseException(); } return($"{instance.Languages.Current.Info.Id}_{partialCache.TemplateTree}_{positionId}_{cacheIdExtension}"); }
private void OnInstanceRequest(ref Basics.Domain.IDomain instance) => instance = this._Instance;
private void OnControlResolveRequest(string controlID, ref Basics.Domain.IDomain workingInstance, out ControlSettings settings) { settings = null; if (string.IsNullOrEmpty(controlID)) { return; } if (workingInstance == null) { workingInstance = this._Instance; } do { ControlSettings localSettings; Basics.Domain.Info.DeploymentTypes deploymentType = ((Domain)workingInstance)._Deployment.DeploymentType; string currentDomainIDAccessTreeString = string.Join <string>("-", workingInstance.IDAccessTree); string cacheSearchKey = string.Format("{0}_{1}", currentDomainIDAccessTreeString, controlID); if (deploymentType == Basics.Domain.Info.DeploymentTypes.Release && Renderer._ControlsCache.TryGetValue(cacheSearchKey, out localSettings)) { settings = localSettings.Clone(); return; } localSettings = new ControlSettings(); XPathNavigator xPathControlNav = ((Domain)workingInstance)._Deployment.Controls.Select(controlID); if (xPathControlNav == null || !xPathControlNav.MoveToFirstChild()) { workingInstance = workingInstance.Parent; continue; } CultureInfo compareCulture = new CultureInfo("en-US"); do { switch (xPathControlNav.Name.ToLower(compareCulture)) { case "type": localSettings.Type = ControlHelper.ParseControlType(xPathControlNav.Value); break; case "bind": localSettings.Bind = Basics.Execution.Bind.Make(xPathControlNav.Value); break; case "attributes": XPathNavigator childReader_attr = xPathControlNav.Clone(); if (childReader_attr.MoveToFirstChild()) { do { localSettings.Attributes.Add( childReader_attr.GetAttribute("key", childReader_attr.BaseURI).ToLower(), childReader_attr.Value ); } while (childReader_attr.MoveToNext()); } break; case "security": XPathNavigator childReader_sec = xPathControlNav.Clone(); if (childReader_sec.MoveToFirstChild()) { do { switch (childReader_sec.Name.ToLower(compareCulture)) { case "registeredgroup": localSettings.Security.RegisteredGroup = childReader_sec.Value; break; case "friendlyname": localSettings.Security.FriendlyName = childReader_sec.Value; break; case "bind": localSettings.Security.Bind = Basics.Execution.Bind.Make(childReader_sec.Value); break; case "disabled": localSettings.Security.Disabled.Set = true; SecurityDefinition.DisabledDefinition.Types secType; if (!Enum.TryParse <SecurityDefinition.DisabledDefinition.Types>( childReader_sec.GetAttribute("type", childReader_sec.NamespaceURI), out secType)) { secType = SecurityDefinition.DisabledDefinition.Types.Inherited; } localSettings.Security.Disabled.Type = secType; localSettings.Security.Disabled.Value = childReader_sec.Value; break; } } while (childReader_sec.MoveToNext()); } break; case "blockidstoupdate": bool updateLocalBlock; if (!bool.TryParse(xPathControlNav.GetAttribute("localupdate", xPathControlNav.BaseURI), out updateLocalBlock)) { updateLocalBlock = true; } localSettings.UpdateLocalBlock = updateLocalBlock; XPathNavigator childReader_blck = xPathControlNav.Clone(); if (childReader_blck.MoveToFirstChild()) { List <string> blockIDsToUpdate = new List <string>(); do { blockIDsToUpdate.Add(childReader_blck.Value); } while (childReader_blck.MoveToNext()); localSettings.BlockIDsToUpdate = blockIDsToUpdate.ToArray(); } break; case "defaultbuttonid": localSettings.DefaultButtonID = xPathControlNav.Value; break; case "text": localSettings.Text = xPathControlNav.Value; break; case "url": localSettings.URL = xPathControlNav.Value; break; case "content": localSettings.Content = xPathControlNav.Value; break; case "source": localSettings.Source = xPathControlNav.Value; break; } } while (xPathControlNav.MoveToNext()); Renderer._ControlsCache.TryAdd(cacheSearchKey, localSettings); settings = localSettings.Clone(); return; } while (workingInstance != null); }
private void OnDeploymentAccessRequest(ref Basics.Domain.IDomain workingInstance, ref Deployment.Domain deployment) => deployment = ((Domain)workingInstance)._Deployment;
public void Inject(Basics.Domain.IDomain instance) => this._Instance = instance;