public void RegisterMessage(CultureInfo cultureInfo, FailureResultCode code, string message) { lock (lockObj) { if (!messages.TryGetValue(cultureInfo, out var messagesOfCulture)) { messagesOfCulture = new Dictionary <FailureResultCode, string>(); messages.Add(cultureInfo, messagesOfCulture); } if (messagesOfCulture.ContainsKey(code)) { throw new InvalidOperationException("code is already registered"); } messagesOfCulture.Add(code, message); } }
public FailureResult(FailureResultCode code, params object[] args) { Code = code; Args = args; }
public static FailureResult <TResult> Create(FailureResultCode code, params object[] args) { return(new FailureResult <TResult>(code, args)); }