Beispiel #1
0
        /// <summary>
        /// Executes the CommandBuilder using a provided database manager and optionally a filter to read parameters from and explicit
        /// parameters.
        /// </summary>
        /// <param name="databaseManager">The database manager.</param>
        /// <param name="filter">The filter.</param>
        /// <param name="parameterObject">The parameter object.</param>
        /// <param name="explicitParameters">The explicit parameters.</param>
        /// <exception cref="SusanooExecutionException">Any exception occured during execution.</exception>
        public IResultSetCollection Execute(IDatabaseManager databaseManager,
                                            TFilter filter, object parameterObject, params DbParameter[] explicitParameters)
        {
            IExecutableCommandInfo executableCommandInfo = new ExecutableCommandInfo
            {
                CommandText   = CommandBuilderInfo.CommandText,
                DbCommandType = CommandBuilderInfo.DbCommandType,
                Parameters    = CommandBuilderInfo.BuildParameters(databaseManager, filter, parameterObject, explicitParameters)
            };

            return(Execute(databaseManager, executableCommandInfo));
        }
Beispiel #2
0
        /// <summary>
        /// Assembles a data CommandBuilder for an ADO.NET provider,
        /// executes the CommandBuilder and uses pre-compiled mappings to assign the resultant data to the result object type.
        /// </summary>
        /// <param name="databaseManager">The database manager.</param>
        /// <param name="filter">The filter.</param>
        /// <param name="parameterObject">The parameter object.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <param name="explicitParameters">The explicit parameters.</param>
        /// <returns>Task&lt;IEnumerable&lt;TResult&gt;&gt;.</returns>
        public async Task <IResultSetCollection> ExecuteAsync(IDatabaseManager databaseManager, TFilter filter, object parameterObject,
                                                              CancellationToken cancellationToken, params DbParameter[] explicitParameters)
        {
            IExecutableCommandInfo executableCommandInfo = new ExecutableCommandInfo
            {
                CommandText   = CommandBuilderInfo.CommandText,
                DbCommandType = CommandBuilderInfo.DbCommandType,
                Parameters    = CommandBuilderInfo.BuildParameters(databaseManager, filter, parameterObject, explicitParameters)
            };

            return(await ExecuteAsync(databaseManager, executableCommandInfo, cancellationToken)
                   .ConfigureAwait(false));
        }
        /// <summary>
        ///     Executes the scalar.
        /// </summary>
        /// <typeparam name="TReturn">The type of the return.</typeparam>
        /// <param name="databaseManager">The database manager.</param>
        /// <param name="filter">The filter.</param>
        /// <param name="parameterObject">The parameter object.</param>
        /// <param name="explicitParameters">The explicit parameters.</param>
        /// <returns>TReturn.</returns>
        public TReturn ExecuteScalar <TReturn>(IDatabaseManager databaseManager, TFilter filter,
                                               object parameterObject, params DbParameter[] explicitParameters)
        {
            var executableCommandInfo = new ExecutableCommandInfo
            {
                CommandText   = CommandBuilderInfo.CommandText,
                DbCommandType = CommandBuilderInfo.DbCommandType,
                Parameters    = CommandBuilderInfo
                                .BuildParameters(databaseManager, filter, parameterObject, explicitParameters)
            };

            return(ExecuteScalar <TReturn>(databaseManager, executableCommandInfo));
        }