mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
bug : Select dynamic byte[]
This commit is contained in:
parent
f62c15d74d
commit
66726e5f07
@ -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>
|
||||
|
@ -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 &&
|
||||
|
Loading…
Reference in New Issue
Block a user