From f9133c0fe666ce3d854decbf005237cc2593e404 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Thu, 25 May 2017 09:43:21 +0800 Subject: [PATCH] - --- SqlSugar/Common/IsWhatExtensions.cs | 93 +++---------------------- SqlSugar/Entities/ConnectionConfig.cs | 7 -- SqlSugar/Interface/IConnectionConfig.cs | 15 ++++ SqlSugar/SqlSugar.csproj | 1 + 4 files changed, 24 insertions(+), 92 deletions(-) create mode 100644 SqlSugar/Interface/IConnectionConfig.cs diff --git a/SqlSugar/Common/IsWhatExtensions.cs b/SqlSugar/Common/IsWhatExtensions.cs index 249df3163..5e3a1b3b0 100644 --- a/SqlSugar/Common/IsWhatExtensions.cs +++ b/SqlSugar/Common/IsWhatExtensions.cs @@ -7,141 +7,80 @@ namespace SqlSugar { internal static class IsWhatExtensions { - /// - /// 值在的范围? - /// - /// - /// 大于等于begin - /// 小于等于end - /// + public static bool IsInRange(this int thisValue, int begin, int end) { return thisValue >= begin && thisValue <= end; } - /// - /// 值在的范围? - /// - /// - /// 大于等于begin - /// 小于等于end - /// + public static bool IsInRange(this DateTime thisValue, DateTime begin, DateTime end) { return thisValue >= begin && thisValue <= end; } - /// - /// 在里面吗? - /// - /// - /// - /// - /// public static bool IsIn(this T thisValue, params T[] values) { return values.Contains(thisValue); } - /// - /// 在里面吗? - /// - /// - /// - /// public static bool IsContainsIn(this string thisValue, params string[] inValues) { return inValues.Any(it => thisValue.Contains(it)); } - /// - /// 是null或""? - /// - /// public static bool IsNullOrEmpty(this object thisValue) { if (thisValue == null || thisValue == DBNull.Value) return true; return thisValue.ToString() == ""; } - /// - /// 是null或""? - /// - /// + public static bool IsNullOrEmpty(this Guid? thisValue) { if (thisValue == null) return true; return thisValue == Guid.Empty; } - /// - /// 是null或""? - /// - /// + public static bool IsNullOrEmpty(this Guid thisValue) { if (thisValue == null) return true; return thisValue == Guid.Empty; } - /// - /// 是null或""? - /// - /// public static bool IsNullOrEmpty(this IEnumerable thisValue) { if (thisValue == null || thisValue.Count() == 0) return true; return false; } - /// - /// 有值?(与IsNullOrEmpty相反) - /// - /// public static bool IsValuable(this object thisValue) { if (thisValue == null || thisValue == DBNull.Value) return false; return thisValue.ToString() != ""; } - /// - /// 有值?(与IsNullOrEmpty相反) - /// - /// + public static bool IsValuable(this IEnumerable thisValue) { if (thisValue == null || thisValue.Count() == 0) return false; return true; } - /// - /// 有值?(与IsNullOrEmpty相反) - /// - /// + public static bool IsValuable(this IEnumerable> thisValue) { if (thisValue == null || thisValue.Count() == 0) return false; return true; } - /// - /// 是零? - /// - /// - /// + public static bool IsZero(this object thisValue) { return (thisValue == null || thisValue.ToString() == "0"); } - /// - /// 是INT? - /// - /// - /// public static bool IsInt(this object thisValue) { if (thisValue == null) return false; return Regex.IsMatch(thisValue.ToString(), @"^\d+$"); } - /// - /// 不是INT? - /// - /// + /// public static bool IsNoInt(this object thisValue) { @@ -149,23 +88,12 @@ namespace SqlSugar return !Regex.IsMatch(thisValue.ToString(), @"^\d+$"); } - /// - /// 是金钱? - /// - /// - /// public static bool IsMoney(this object thisValue) { if (thisValue == null) return false; double outValue = 0; return double.TryParse(thisValue.ToString(), out outValue); } - - /// - /// 是GUID? - /// - /// - /// public static bool IsGuid(this object thisValue) { if (thisValue == null) return false; @@ -173,11 +101,6 @@ namespace SqlSugar return Guid.TryParse(thisValue.ToString(), out outValue); } - /// - /// 是时间? - /// - /// - /// public static bool IsDate(this object thisValue) { if (thisValue == null) return false; diff --git a/SqlSugar/Entities/ConnectionConfig.cs b/SqlSugar/Entities/ConnectionConfig.cs index 6e428c2f6..1991d3f73 100644 --- a/SqlSugar/Entities/ConnectionConfig.cs +++ b/SqlSugar/Entities/ConnectionConfig.cs @@ -5,13 +5,6 @@ using System.Text; using System.Threading.Tasks; namespace SqlSugar { - public interface IConnectionConfig - { - string DbType { get; set; } - string ConnectionString { get; set; } - bool IsAutoCloseConnection { get; set; } - } - public class SystemTableConfig : IConnectionConfig { public string DbType { get; set; } diff --git a/SqlSugar/Interface/IConnectionConfig.cs b/SqlSugar/Interface/IConnectionConfig.cs new file mode 100644 index 000000000..de1063d7a --- /dev/null +++ b/SqlSugar/Interface/IConnectionConfig.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SqlSugar +{ + public interface IConnectionConfig + { + string DbType { get; set; } + string ConnectionString { get; set; } + bool IsAutoCloseConnection { get; set; } + } + +} diff --git a/SqlSugar/SqlSugar.csproj b/SqlSugar/SqlSugar.csproj index 3de907f6f..a6c243cdb 100644 --- a/SqlSugar/SqlSugar.csproj +++ b/SqlSugar/SqlSugar.csproj @@ -58,6 +58,7 @@ +