/// <summary>
        ///     Executes a request that queries values on a single table, with constraints.
        /// </summary>
        /// <parameters>
        /// <param name="context">Description of the request.</param>
        /// </parameters>
        /// <returns>
        ///     The request result.
        /// </returns>
        public ISingleQueryResult Run(ISingleQueryContext context)
        {
            Debug.Assert(Connector != null);
            Debug.Assert(Connector.IsOpen);

            return(Execute(context));
        }
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
        public Task <ISingleQueryResult> RunAsync(ISingleQueryContext context)
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member
        {
            Debug.Assert(Connector != null);
            Debug.Assert(Connector.IsOpen);

            return(Task.Run(() => Execute(context)));
        }
Example #3
0
        public override IActiveOperation <ISingleQueryResultInternal> SingleQuery(ISingleQueryContext context)
        {
            IMySqlSingleQueryOperation Operation = new MySqlSingleQueryOperation(context);

            return(PrepareReaderOperation <ISingleQueryContext, IMySqlSingleQueryOperation, ISingleQueryOperation, ISingleQueryResult, ISingleQueryResultInternal>(
                       Operation,
                       (ISingleQueryOperation operation, IAsyncResult asyncResult) => new SingleQueryResult(operation, asyncResult),
                       (MySqlCommand command, ISingleQueryResultInternal result) => Operation.FinalizeOperation(command, result)));
        }
        /// <summary>
        ///     Executes a request that queries values on a single table, with constraints.
        ///     This is the synchronous implementation.
        /// </summary>
        /// <parameters>
        /// <param name="context">Description of the request.</param>
        /// </parameters>
        /// <returns>
        ///     The request result.
        /// </returns>
        protected virtual ISingleQueryResult Execute(ISingleQueryContext context)
        {
            if (!IsOperationThreadStarted)
            {
                return(new SingleQueryResult(false, ResultError.ErrorFatalNoOperationThread));
            }

            IActiveOperation <ISingleQueryResultInternal> ActiveOperation = Connector.SingleQuery(context);
            ISingleQueryResultInternal Result = ActiveOperation.Result;

            FinalizeOrQueue(ActiveOperation);

            return(Result);
        }
Example #5
0
 public abstract IActiveOperation <ISingleQueryResultInternal> SingleQuery(ISingleQueryContext context);
 public MySqlSingleQueryOperation(ISingleQueryContext context)
     : base(context)
 {
 }