/// <summary>
        /// Clones this clause.
        /// </summary>
        /// <param name="cloneContext">The clones of all query source clauses are registered with this <see cref="CloneContext"/>.</param>
        /// <returns>A clone of this clause.</returns>
        public UpdateAndReturnClause Clone(CloneContext cloneContext)
        {
            Utils.CheckNotNull("cloneContext", cloneContext);

            var result = new UpdateAndReturnClause(WithSelector,ItemName,CollectionType,KeySelector,Command);
            return result;
        }
Beispiel #2
0
        /// <summary>
        /// Clones this clause.
        /// </summary>
        /// <param name="cloneContext">The clones of all query source clauses are registered with this <see cref="CloneContext"/>.</param>
        /// <returns>A clone of this clause.</returns>
        public UpdateAndReturnClause Clone(CloneContext cloneContext)
        {
            Utils.CheckNotNull("cloneContext", cloneContext);

            var result = new UpdateAndReturnClause(WithSelector, ItemName, CollectionType, KeySelector, Command);

            return(result);
        }
        public void VisitUpdateAndReturnClause(UpdateAndReturnClause updateAndReturnClause, QueryModel queryModel)
        {
            if (updateAndReturnClause.KeySelector != null)
            {
                QueryText.AppendFormat(" {0} ", updateAndReturnClause.Command);

                GetAqlExpression(updateAndReturnClause.KeySelector, queryModel);

                QueryText.AppendFormat(" with ");
            }
            else
            {
                QueryText.AppendFormat(" {0} {1} with ", updateAndReturnClause.Command, LinqUtility.ResolvePropertyName(updateAndReturnClause.ItemName));
            }

            GetAqlExpression(updateAndReturnClause.WithSelector, queryModel);

            CrudState.ModelVisitorHaveCrudOperation = true;
            CrudState.Collection = LinqUtility.ResolveCollectionName(Db, updateAndReturnClause.CollectionType);
            CrudState.ReturnResult = updateAndReturnClause.ReturnResult;
            CrudState.ReturnResultKind = updateAndReturnClause.ReturnNewResult ? "new" : "old";
        }