/// <summary> Builds a derivation document expression. </summary> /// <returns> The document expression to use. </returns> public string BuildDerivationExpression(DerivationSeed seed) { return(String.Format ( ".Frontend.Derive('{0}', '{1}', '{2}', '{3}', {4})", seed.Query.Replace("'", "''"), seed.PageType, seed.MasterKeyNames, seed.DetailKeyNames, Convert.ToString(seed.Elaborate).ToLower() )); }
protected XmlDocument BuildInterface(Program program, DerivationSeed seed) { return(new InterfaceBuilder(program, seed).Build()); }
public override object InternalExecute(Program program, object[] arguments) { string query = (string)arguments[0]; string pageType = DefaultPageType; string masterKeyNames = String.Empty; string detailKeyNames = String.Empty; bool elaborate = DefaultElaborate; if (arguments.Length >= 2) { if (Operator.Operands[1].DataType.Equals(program.DataTypes.SystemString)) { pageType = (string)arguments[1]; if (arguments.Length == 3) { elaborate = (bool)arguments[2]; } else if (arguments.Length >= 4) { masterKeyNames = (string)arguments[2]; detailKeyNames = (string)arguments[3]; if (arguments.Length == 5) { elaborate = (bool)arguments[4]; } } } else { elaborate = (bool)arguments[1]; } } FrontendServer server = FrontendServer.GetFrontendServer(program.ServerProcess.ServerSession.Server); FrontendSession session = server.GetFrontendSession(program.ServerProcess.ServerSession); DerivationSeed seed = new DerivationSeed(pageType, query, elaborate, masterKeyNames, detailKeyNames); XmlDocument document; if (session.UseDerivationCache) { lock (session.DerivationCache) { session.EnsureDerivationCacheConsistent(); DerivationCacheItem item; if (!session.DerivationCache.TryGetValue(seed, out item)) { document = BuildInterface(program, seed); session.DerivationCache.Add(seed, new DerivationCacheItem(document)); } else { document = item.Document; } } } else { document = BuildInterface(program, seed); } return(document.OuterXml); }