Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 3430da6

Browse files
committed
fix query using bytes
1 parent 932e387 commit 3430da6

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

src/ServiceStack.OrmLite/OrmLiteReadCommandExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ private static IEnumerable GetMultiValues(object value)
9696

9797
return (value is IEnumerable enumerable &&
9898
!(enumerable is string ||
99-
enumerable is IEnumerable<KeyValuePair<string, object>>)
99+
enumerable is IEnumerable<KeyValuePair<string, object>> ||
100+
enumerable is byte[])
100101
) ? enumerable : null;
101102
}
102103

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using NUnit.Framework;
7+
using ServiceStack.Logging;
8+
using ServiceStack.Text;
9+
10+
namespace ServiceStack.OrmLite.Tests.Issues
11+
{
12+
public class SelectWithBytesIssue : OrmLiteTestBase
13+
{
14+
public class ModelWithBytes
15+
{
16+
public int Id { get; set; }
17+
public byte[] Bytes { get; set; }
18+
}
19+
20+
[Test]
21+
public void Can_select_ModelWithBytes_using_anon_type()
22+
{
23+
using (var db = OpenDbConnection())
24+
{
25+
db.DropAndCreateTable<ModelWithBytes>();
26+
27+
db.Insert(new ModelWithBytes
28+
{
29+
Id = 1,
30+
Bytes = 1.ToUtf8Bytes()
31+
});
32+
33+
var result = db.Single<ModelWithBytes>(new
34+
{
35+
Bytes = 1.ToUtf8Bytes()
36+
});
37+
38+
Assert.That(result, Is.Not.Null);
39+
}
40+
}
41+
42+
}
43+
}

0 commit comments

Comments
 (0)