Check.cs

2076 ワード

SqlSugar\Src\Asp.Net\SqlSugar\Utilities\Check.cs機能:SqlSugar異常処理静関数
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SqlSugar
{
    public class Check
    {
        /// 
        ///          UtilException
        /// 
        ///         NotSupportedException,     message  UtilExceptions
        public static void ThrowNotSupportedException(string message)
        {
            message = message.IsNullOrEmpty() ? new NotSupportedException().Message : message;
            throw new UtilExceptions("SqlSugarException.NotSupportedException:" + message);
        }

        /// 
        ///      checkObj message  
        ///   checkObj     UtilException,  message  
        /// 
        ///    Obj
        ///     message   
        public static void ArgumentNullException(object checkObj, string message)
        {
            if (checkObj == null)
                throw new UtilExceptions("SqlSugarException.ArgumentNullException:" + message);
        }

        /// 
        ///     checkObj      
        /// 
        ///   Obj  
        ///        
        public static void ArgumentNullException(object [] checkObj, string message)
        {
            //checkOjb      checkOjb     0
            if (checkObj == null || checkObj.Length==0)
                throw new UtilExceptions("SqlSugarException.ArgumentNullException:" + message);
        }

        /// 
        ///          UtilExceptions
        /// 
        ///   Exception    
        ///   Message
        ///   Message     
        public static void Exception(bool isException, string message, params string[] args)
        {
            if (isException)
                throw new UtilExceptions(string.Format(message, args));
        }
    }
}