mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-17 10:41:56 +08:00
-
This commit is contained in:
parent
f6ed271aa1
commit
f9133c0fe6
@ -7,141 +7,80 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
internal static class IsWhatExtensions
|
internal static class IsWhatExtensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// 值在的范围?
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="thisValue"></param>
|
|
||||||
/// <param name="begin">大于等于begin</param>
|
|
||||||
/// <param name="end">小于等于end</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static bool IsInRange(this int thisValue, int begin, int end)
|
public static bool IsInRange(this int thisValue, int begin, int end)
|
||||||
{
|
{
|
||||||
return thisValue >= begin && thisValue <= end;
|
return thisValue >= begin && thisValue <= end;
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// 值在的范围?
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="thisValue"></param>
|
|
||||||
/// <param name="begin">大于等于begin</param>
|
|
||||||
/// <param name="end">小于等于end</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static bool IsInRange(this DateTime thisValue, DateTime begin, DateTime end)
|
public static bool IsInRange(this DateTime thisValue, DateTime begin, DateTime end)
|
||||||
{
|
{
|
||||||
return thisValue >= begin && thisValue <= end;
|
return thisValue >= begin && thisValue <= end;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 在里面吗?
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T"></typeparam>
|
|
||||||
/// <param name="thisValue"></param>
|
|
||||||
/// <param name="values"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static bool IsIn<T>(this T thisValue, params T[] values)
|
public static bool IsIn<T>(this T thisValue, params T[] values)
|
||||||
{
|
{
|
||||||
return values.Contains(thisValue);
|
return values.Contains(thisValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 在里面吗?
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="thisValue"></param>
|
|
||||||
/// <param name="inValues"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static bool IsContainsIn(this string thisValue, params string[] inValues)
|
public static bool IsContainsIn(this string thisValue, params string[] inValues)
|
||||||
{
|
{
|
||||||
return inValues.Any(it => thisValue.Contains(it));
|
return inValues.Any(it => thisValue.Contains(it));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是null或""?
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static bool IsNullOrEmpty(this object thisValue)
|
public static bool IsNullOrEmpty(this object thisValue)
|
||||||
{
|
{
|
||||||
if (thisValue == null || thisValue == DBNull.Value) return true;
|
if (thisValue == null || thisValue == DBNull.Value) return true;
|
||||||
return thisValue.ToString() == "";
|
return thisValue.ToString() == "";
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// 是null或""?
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static bool IsNullOrEmpty(this Guid? thisValue)
|
public static bool IsNullOrEmpty(this Guid? thisValue)
|
||||||
{
|
{
|
||||||
if (thisValue == null) return true;
|
if (thisValue == null) return true;
|
||||||
return thisValue == Guid.Empty;
|
return thisValue == Guid.Empty;
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// 是null或""?
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static bool IsNullOrEmpty(this Guid thisValue)
|
public static bool IsNullOrEmpty(this Guid thisValue)
|
||||||
{
|
{
|
||||||
if (thisValue == null) return true;
|
if (thisValue == null) return true;
|
||||||
return thisValue == Guid.Empty;
|
return thisValue == Guid.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是null或""?
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static bool IsNullOrEmpty(this IEnumerable<object> thisValue)
|
public static bool IsNullOrEmpty(this IEnumerable<object> thisValue)
|
||||||
{
|
{
|
||||||
if (thisValue == null || thisValue.Count() == 0) return true;
|
if (thisValue == null || thisValue.Count() == 0) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 有值?(与IsNullOrEmpty相反)
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static bool IsValuable(this object thisValue)
|
public static bool IsValuable(this object thisValue)
|
||||||
{
|
{
|
||||||
if (thisValue == null || thisValue == DBNull.Value) return false;
|
if (thisValue == null || thisValue == DBNull.Value) return false;
|
||||||
return thisValue.ToString() != "";
|
return thisValue.ToString() != "";
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// 有值?(与IsNullOrEmpty相反)
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static bool IsValuable(this IEnumerable<object> thisValue)
|
public static bool IsValuable(this IEnumerable<object> thisValue)
|
||||||
{
|
{
|
||||||
if (thisValue == null || thisValue.Count() == 0) return false;
|
if (thisValue == null || thisValue.Count() == 0) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// 有值?(与IsNullOrEmpty相反)
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static bool IsValuable(this IEnumerable<KeyValuePair<string,string>> thisValue)
|
public static bool IsValuable(this IEnumerable<KeyValuePair<string,string>> thisValue)
|
||||||
{
|
{
|
||||||
if (thisValue == null || thisValue.Count() == 0) return false;
|
if (thisValue == null || thisValue.Count() == 0) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// 是零?
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="thisValue"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static bool IsZero(this object thisValue)
|
public static bool IsZero(this object thisValue)
|
||||||
{
|
{
|
||||||
return (thisValue == null || thisValue.ToString() == "0");
|
return (thisValue == null || thisValue.ToString() == "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是INT?
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="thisValue"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static bool IsInt(this object thisValue)
|
public static bool IsInt(this object thisValue)
|
||||||
{
|
{
|
||||||
if (thisValue == null) return false;
|
if (thisValue == null) return false;
|
||||||
return Regex.IsMatch(thisValue.ToString(), @"^\d+$");
|
return Regex.IsMatch(thisValue.ToString(), @"^\d+$");
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// 不是INT?
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="thisValue"></param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static bool IsNoInt(this object thisValue)
|
public static bool IsNoInt(this object thisValue)
|
||||||
{
|
{
|
||||||
@ -149,23 +88,12 @@ namespace SqlSugar
|
|||||||
return !Regex.IsMatch(thisValue.ToString(), @"^\d+$");
|
return !Regex.IsMatch(thisValue.ToString(), @"^\d+$");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是金钱?
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="thisValue"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static bool IsMoney(this object thisValue)
|
public static bool IsMoney(this object thisValue)
|
||||||
{
|
{
|
||||||
if (thisValue == null) return false;
|
if (thisValue == null) return false;
|
||||||
double outValue = 0;
|
double outValue = 0;
|
||||||
return double.TryParse(thisValue.ToString(), out outValue);
|
return double.TryParse(thisValue.ToString(), out outValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是GUID?
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="thisValue"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static bool IsGuid(this object thisValue)
|
public static bool IsGuid(this object thisValue)
|
||||||
{
|
{
|
||||||
if (thisValue == null) return false;
|
if (thisValue == null) return false;
|
||||||
@ -173,11 +101,6 @@ namespace SqlSugar
|
|||||||
return Guid.TryParse(thisValue.ToString(), out outValue);
|
return Guid.TryParse(thisValue.ToString(), out outValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是时间?
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="thisValue"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static bool IsDate(this object thisValue)
|
public static bool IsDate(this object thisValue)
|
||||||
{
|
{
|
||||||
if (thisValue == null) return false;
|
if (thisValue == null) return false;
|
||||||
|
@ -5,13 +5,6 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
namespace SqlSugar
|
namespace SqlSugar
|
||||||
{
|
{
|
||||||
public interface IConnectionConfig
|
|
||||||
{
|
|
||||||
string DbType { get; set; }
|
|
||||||
string ConnectionString { get; set; }
|
|
||||||
bool IsAutoCloseConnection { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class SystemTableConfig : IConnectionConfig
|
public class SystemTableConfig : IConnectionConfig
|
||||||
{
|
{
|
||||||
public string DbType { get; set; }
|
public string DbType { get; set; }
|
||||||
|
15
SqlSugar/Interface/IConnectionConfig.cs
Normal file
15
SqlSugar/Interface/IConnectionConfig.cs
Normal file
@ -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; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -58,6 +58,7 @@
|
|||||||
<Compile Include="Abstract\InsertableProvider\InsertableProvider.cs" />
|
<Compile Include="Abstract\InsertableProvider\InsertableProvider.cs" />
|
||||||
<Compile Include="Abstract\DeleteProvider\DeleteableProvider.cs" />
|
<Compile Include="Abstract\DeleteProvider\DeleteableProvider.cs" />
|
||||||
<Compile Include="Abstract\UpdateProvider\UpdateableProvider.cs" />
|
<Compile Include="Abstract\UpdateProvider\UpdateableProvider.cs" />
|
||||||
|
<Compile Include="Interface\IConnectionConfig.cs" />
|
||||||
<Compile Include="Realization\SqlServer\Core\SqlBuilder\SqlServerDeleteBuilder.cs" />
|
<Compile Include="Realization\SqlServer\Core\SqlBuilder\SqlServerDeleteBuilder.cs" />
|
||||||
<Compile Include="Realization\SqlServer\Core\SqlBuilder\SqlServerInsertBuilder.cs" />
|
<Compile Include="Realization\SqlServer\Core\SqlBuilder\SqlServerInsertBuilder.cs" />
|
||||||
<Compile Include="Entities\EntityColumnInfo.cs" />
|
<Compile Include="Entities\EntityColumnInfo.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user