示例#1
0
        //------------------------------------------
        // EXECUTION
        //-----------------------------------------

        #region Execution

        /// <summary>
        /// Executes this instance with result.
        /// </summary>
        /// <param name="resultString">The result to get.</param>
        /// <param name="appScope">The application scope to consider.</param>
        /// <param name="scriptVariableSet">The script variable set to use.</param>
        /// <param name="runtimeMode">The runtime mode to consider.</param>
        /// <returns>The log of execution log.</returns>
        public override ILog ExecuteWithResult(
            out string resultString,
            IAppScope appScope = null,
            IScriptVariableSet scriptVariableSet = null,
            RuntimeMode runtimeMode = RuntimeMode.Normal)
        {
            resultString = "";

            ILog log = appScope.Check(true);

            if (this.Reference == null)
            {
                log.AddWarning(
                    title: "Reference missing",
                    description: "No reference defined in command '" + this.Key() + "'.");
            }
            else if (!log.HasErrorsOrExceptions() && this.Reference != null)
            {
                scriptVariableSet.SetValue("currentItem", this.Reference.SourceElement.GetObject());
                scriptVariableSet.SetValue("currentElement", this.Reference.SourceElement);
                resultString = this.Reference.Get(appScope, scriptVariableSet, log)?.ToString();
            }

            return(log);
        }
示例#2
0
        /// <summary>
        /// Sets the database query builder in the specified script variable set.
        /// </summary>
        /// <param name="scriptVariableSet">The script variable set to consider.</param>
        /// <param name="queryBuilder">The query builder to consider.</param>
        /// <returns></returns>
        public static IScriptVariableSet SetDbBuilder(
            this IScriptVariableSet scriptVariableSet,
            DbQueryBuilder queryBuilder)
        {
            scriptVariableSet?.SetValue(__DbBuilder, queryBuilder);

            return(scriptVariableSet);
        }