예제 #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);
     }
 }