Пример #1
0
 public static void Exception <TException>(string message = null,
                                           object[] args  = null,
                                           params KeyValuePair <string, object>[] data)
     where TException : Exception, new()
 {
     throw ExceptionProvider.GenerateException <TException>(message, args, data);
 }
Пример #2
0
 internal static void ThrowIfNull <T, TException>(this T obj, string message = null) where TException : Exception, new()
 {
     if (obj == null)
     {
         throw ExceptionProvider.GenerateException <TException>(message);
     }
 }
Пример #3
0
 public static void IfNot <TException>(Func <bool> predicate,
                                       string message = null,
                                       object[] args  = null,
                                       params KeyValuePair <string, object>[] data)
     where TException : Exception, new()
 {
     if (!predicate())
     {
         throw ExceptionProvider.GenerateException <TException>(message, args, data);
     }
 }
Пример #4
0
 public static void IfNullOrEmpty <TException>(string obj,
                                               string message = null,
                                               object[] args  = null,
                                               params KeyValuePair <string, object>[] data)
     where TException : Exception, new()
 {
     if (string.IsNullOrWhiteSpace(obj))
     {
         throw ExceptionProvider.GenerateException <TException>(message, args, data);
     }
 }