/// <summary> /// Invokes an action for a request. /// </summary> /// <param name="request">The request.</param> /// <param name="throwException"> /// Rethrow exception (<see langword="true" />) or not (<see langword="false" />). /// </param> /// <returns> /// Operation was successfull (<see langword="true" />) or not <see langword="false" />. /// <see langword="null" /> indicates that <paramref name="request" /> is <see langword="null" />. /// </returns> protected bool? InvokeForRequest(UnknownRecord request, bool throwException = false) { if (request == null) { return null; } try { if (request is BeginRequestRecord) { this.BeginRequest(request as BeginRequestRecord); return true; } } catch (Exception ex) { this.RaiseError(ex, throwException); } return false; }
/// <summary> /// Invokes an action for a request. /// </summary> /// <param name="request">The request.</param> /// <param name="throwException"> /// Rethrow exception (<see langword="true" />) or not (<see langword="false" />). /// </param> /// <returns> /// Operation was successfull (<see langword="true" />) or not <see langword="false" />. /// <see langword="null" /> indicates that <paramref name="request" /> is <see langword="null" />. /// </returns> protected bool? InvokeForRequest(UnknownRecord request, bool throwException = false) { if (request == null) { return null; } try { if (request is BeginRequestRecord) { if (this.Level >= this.Server._SETTINGS.MaxRequestsByConnection) { return false; } this.Handler.BeginRequest(request as BeginRequestRecord, this.Level + 1); return true; } if (request.RequestId == this.BaseRecord.RequestId) { if (this.HasEnded) { return false; } if (request is ParameterRecord) { this.HandleParameters(request as ParameterRecord); return true; } if (request is InputRecord) { this.HandleInputData(request as InputRecord); return true; } } else { this.End(); } } catch (Exception ex) { this.RaiseError(ex, throwException); } return false; }