bug : Select dynamic byte[]

This commit is contained in:
skx 2020-12-04 20:22:09 +08:00
parent f62c15d74d
commit 66726e5f07
2 changed files with 30 additions and 0 deletions

View File

@ -137,6 +137,24 @@ namespace OrmTest
});
int i = 0;
var salist= sa.ToPageList(1,2,ref i);
db.CodeFirst.InitTables<UnitBytes11>();
db.Insertable(new UnitBytes11() { bytes = null, name = "a" }).ExecuteCommand();
db.Insertable(new UnitBytes11() { bytes=new byte[] { 1,2} , name="a"}).ExecuteCommand();
var bytes = db.Queryable<UnitBytes11>().Select(it => new
{
b = it.bytes,
name="a"
}).ToList();
}
public class UnitBytes11
{
[SugarColumn(Length =200,IsNullable =true)]
public byte[] bytes { get; set; }
public string name{ get; set; }
}
/// <summary>

View File

@ -286,6 +286,10 @@ namespace SqlSugar
{
result.Add(name, DeserializeObject<List<Dictionary<string, object>>>(readerValues[item.Name.ToLower()].ToString()));
}
else if (IsBytes(readerValues, item))
{
result.Add(name,(byte[])readerValues[item.Name.ToLower()]);
}
else
{
result.Add(name, DataReaderToDynamicList_Part(readerValues, item, reval));
@ -335,6 +339,14 @@ namespace SqlSugar
return result;
}
private static bool IsBytes(Dictionary<string, object> readerValues, PropertyInfo item)
{
return item.PropertyType == UtilConstants.ByteArrayType &&
readerValues.ContainsKey(item.Name.ToLower())&&
(readerValues[item.Name.ToLower()]==null||
readerValues[item.Name.ToLower()].GetType()==UtilConstants.ByteArrayType);
}
private static bool IsJsonItem(Dictionary<string, object> readerValues, string name)
{
return readerValues != null &&