mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-12-02 03:13:58 +08:00
-
This commit is contained in:
@@ -9,7 +9,38 @@ namespace SqlSugar
|
||||
{
|
||||
public abstract partial class DbBindProvider : DbBindAccessory, IDbBind
|
||||
{
|
||||
#region Properties
|
||||
public virtual SqlSugarClient Context { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Public methods
|
||||
public virtual List<T> DataReaderToList<T>(Type type, IDataReader dataReader, string fields)
|
||||
{
|
||||
using (dataReader)
|
||||
{
|
||||
if (type.Name.Contains("KeyValuePair"))
|
||||
{
|
||||
return GetKeyValueList<T>(type, dataReader);
|
||||
}
|
||||
else if (type.IsValueType || type == PubConst.StringType)
|
||||
{
|
||||
return GetValueTypeList<T>(type, dataReader);
|
||||
}
|
||||
else if (type.IsArray)
|
||||
{
|
||||
return GetArrayList<T>(type, dataReader);
|
||||
}
|
||||
else
|
||||
{
|
||||
return GetEntityList<T>(type, Context, dataReader, fields);
|
||||
}
|
||||
}
|
||||
}
|
||||
public abstract string ChangeDBTypeToCSharpType(string typeName);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Throw rule
|
||||
public virtual List<string> GuidThrow
|
||||
{
|
||||
get
|
||||
@@ -59,28 +90,6 @@ namespace SqlSugar
|
||||
return new List<string>() { "datetime", "guid" };
|
||||
}
|
||||
}
|
||||
public virtual List<T> DataReaderToList<T>(Type type, IDataReader dataReader,string fields)
|
||||
{
|
||||
using (dataReader)
|
||||
{
|
||||
if (type.Name.Contains("KeyValuePair"))
|
||||
{
|
||||
return GetKeyValueList<T>(type, dataReader);
|
||||
}
|
||||
else if (type.IsValueType || type == PubConst.StringType)
|
||||
{
|
||||
return GetValueTypeList<T>(type, dataReader);
|
||||
}
|
||||
else if (type.IsArray)
|
||||
{
|
||||
return GetArrayList<T>(type, dataReader);
|
||||
}
|
||||
else
|
||||
{
|
||||
return GetEntityList<T>(type, Context, dataReader, fields);
|
||||
}
|
||||
}
|
||||
}
|
||||
public abstract string ChangeDBTypeToCSharpType(string typeName);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user