예제 #1
0
        /// <summary>
        /// Simply calls through to the <seealso cref="TransactionRepresentation.accept(Visitor)"/> method for each {@link
        /// TransactionToApply} given. This assumes that the <seealso cref="BatchTransactionApplier"/> will return {@link
        /// TransactionApplier}s which actually do the work and that the transaction has all the relevant data.
        /// </summary>
        /// <param name="applier"> to use </param>
        /// <param name="transactions"> to apply </param>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static void apply(org.neo4j.kernel.impl.api.BatchTransactionApplier applier, org.neo4j.kernel.impl.api.TransactionToApply... transactions) throws Exception
        public static void Apply(BatchTransactionApplier applier, params TransactionToApply[] transactions)
        {
            foreach (TransactionToApply tx in transactions)
            {
                using (TransactionApplier txApplier = applier.StartTx(tx, new LockGroup()))
                {
                    tx.TransactionRepresentation().accept(txApplier);
                }
            }
            applier.Close();
        }
예제 #2
0
        /// <summary>
        /// In case the transactions do not have the commands to apply, use this method to apply any commands you want with a
        /// given <seealso cref="ApplyFunction"/> instead.
        /// </summary>
        /// <param name="applier"> to use </param>
        /// <param name="function"> which knows what to do with the <seealso cref="TransactionApplier"/>. </param>
        /// <param name="transactions"> are only used to create <seealso cref="TransactionApplier"/>s. The actual work is delegated to the
        /// function. </param>
        /// <returns> the boolean-and result of all function operations. </returns>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static boolean apply(org.neo4j.kernel.impl.api.BatchTransactionApplier applier, ApplyFunction function, org.neo4j.kernel.impl.api.TransactionToApply... transactions) throws Exception
        public static bool Apply(BatchTransactionApplier applier, ApplyFunction function, params TransactionToApply[] transactions)
        {
            bool result = true;

            foreach (TransactionToApply tx in transactions)
            {
                using (TransactionApplier txApplier = applier.StartTx(tx, new LockGroup()))
                {
                    result &= function(txApplier);
                }
            }
            applier.Close();
            return(result);
        }