コード例 #1
0
        /// <summary>
        /// Internal exists storedProcedure procedure routine
        /// </summary>
        internal async Task <bool> InternalExistsStoredProcedureAsync(SyncContext ctx, DbTableBuilder tableBuilder, DbStoredProcedureType storedProcedureType, DbConnection connection, DbTransaction transaction, CancellationToken cancellationToken, IProgress <ProgressArgs> progress)
        {
            var filter = tableBuilder.TableDescription.GetFilter();

            var existsCommand = await tableBuilder.GetExistsStoredProcedureCommandAsync(storedProcedureType, filter, connection, transaction).ConfigureAwait(false);

            if (existsCommand == null)
            {
                return(false);
            }

            var existsResultObject = await existsCommand.ExecuteScalarAsync().ConfigureAwait(false);

            var exists = Convert.ToInt32(existsResultObject) > 0;

            return(exists);
        }
コード例 #2
0
        /// <summary>
        /// Internal exists storedProcedure procedure routine
        /// </summary>
        internal async Task <(SyncContext context, bool exists)> InternalExistsStoredProcedureAsync(IScopeInfo scopeInfo, SyncContext context, DbTableBuilder tableBuilder, DbStoredProcedureType storedProcedureType, DbConnection connection, DbTransaction transaction, CancellationToken cancellationToken, IProgress <ProgressArgs> progress)
        {
            var filter = tableBuilder.TableDescription.GetFilter();

            var existsCommand = await tableBuilder.GetExistsStoredProcedureCommandAsync(storedProcedureType, filter, connection, transaction).ConfigureAwait(false);

            if (existsCommand == null)
            {
                return(context, false);
            }

            await this.InterceptAsync(new DbCommandArgs(context, existsCommand, connection, transaction), progress, cancellationToken).ConfigureAwait(false);

            var existsResultObject = await existsCommand.ExecuteScalarAsync().ConfigureAwait(false);

            var exists = Convert.ToInt32(existsResultObject) > 0;

            return(context, exists);
        }