internal CommandRejection(string key, object value, CommandRejectionReason reason, string message, object data) { Key = key; Value = value; Reason = reason; Message = message; Data = data; }
internal CommandRejection(string key, object value, CommandRejectionReason reason, string message) : this(key, value, reason, message, null) { }
internal CommandRejection(string key, object value, CommandRejectionReason reason) : this(key, value, reason, null, null) { }
private void AddError(string key, object value, CommandRejectionReason reason, object data = null) { key = key?.Trim() ?? ""; string errorsKey = Errors.Select(x => x.Key).SingleOrDefault(x => x.Equals(key, StringComparison.InvariantCultureIgnoreCase)); if (errorsKey != null) key = errorsKey; if (!Errors.ContainsKey(key)) Errors[key] = null; CommandRejection[] commandRejections = Errors[key] ?? new CommandRejection[0]; List<CommandRejection> errorsAsList = commandRejections.ToList(); errorsAsList.Add(new CommandRejection(key, value, reason, data)); Errors[key] = errorsAsList.ToArray(); }
public bool HasError(string key, CommandRejectionReason reason) { return Errors.ContainsKey(key) && Errors[key].Any(x => x.Reason == reason); }
internal CommandRejectedException(string key, object value, CommandRejectionReason reason, string message, object data) : this(new Dictionary<string, CommandRejection[]>(StringComparer.OrdinalIgnoreCase) { { key, new[] { new CommandRejection(key, value, reason, message, data), } } }) { }
internal CommandRejectedException(string key, object value, CommandRejectionReason reason, object data) : this(key, value, reason, null, data) { }
public CommandRejectedException(string key, object value, CommandRejectionReason reason) : this(key, value, reason, null, null) { }
public CommandRejection(string key, object value, CommandRejectionReason reason, object data) : this(key, value, reason, null, data) { }