Skip to content

Commit c532dc4

Browse files
committed
Fixed issue ThatRendle#167
1 parent c86482a commit c532dc4

3 files changed

Lines changed: 28 additions & 1 deletion

File tree

Simple.Data.Ado/ListExtensions.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
namespace Simple.Data.Ado
22
{
3+
using System;
34
using System.Collections.Generic;
45

56
internal static class ListExtensions
@@ -8,7 +9,18 @@ public static void SetWithBuffer<T>(this List<T> list, int index, T value)
89
{
910
if (list.Capacity > index)
1011
{
11-
list[index] = value;
12+
while (list.Count < index)
13+
{
14+
list.Add(default(T));
15+
}
16+
if (list.Count == index)
17+
{
18+
list.Add(value);
19+
}
20+
else
21+
{
22+
list[index] = value;
23+
}
1224
}
1325
else
1426
{
0 Bytes
Binary file not shown.

Simple.Data.SqlCe40Test/NorthwindTests.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,20 @@ public void DistinctShouldReturnDistinctList()
4444

4545
Assert.AreEqual(countries.Distinct().Count(), countries.Count);
4646
}
47+
48+
[Test]
49+
public void NestedFindAllIssue167()
50+
{
51+
var db = Database.OpenFile(DatabasePath);
52+
53+
List<dynamic> customers = db.Customers.All().ToList();
54+
55+
foreach (var customer in customers)
56+
{
57+
customer.Orders = db.Orders.FindAllByCustomerID(customer.CustomerID).ToList();
58+
}
59+
60+
Assert.Pass();
61+
}
4762
}
4863
}

0 commit comments

Comments
 (0)