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);
            }
        }
Пример #2
0
 public FailureResult(FailureResultCode code, params object[] args)
 {
     Code = code;
     Args = args;
 }
Пример #3
0
 public static FailureResult <TResult> Create(FailureResultCode code, params object[] args)
 {
     return(new FailureResult <TResult>(code, args));
 }