Skip to content

Commit 75982ff

Browse files
committedDec 18, 2018
Update cache when lazy properties are updated, fixed linq fetch method when fetching a relation on a component, added support for fetching properties of a subclass
1 parent 1c72d03 commit 75982ff

31 files changed

+1058
-307
lines changed
 

‎src/NHibernate.Test/Async/FetchLazyProperties/FetchLazyPropertiesFixture.cs

+281-50
Large diffs are not rendered by default.

‎src/NHibernate.Test/Async/LazyProperty/LazyPropertyFixture.cs

+24
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,30 @@ public async Task CanSetValueForLazyPropertyAsync()
137137
Assert.That(NHibernateUtil.IsPropertyInitialized(book, "ALotOfText"), Is.True);
138138
}
139139

140+
[Test]
141+
public async Task CanUpdateValueForLazyPropertyAsync()
142+
{
143+
Book book;
144+
string text;
145+
using (var s = OpenSession())
146+
using (var tx = s.BeginTransaction())
147+
{
148+
book = await (s.GetAsync<Book>(1));
149+
book.ALotOfText = "text";
150+
151+
await (tx.CommitAsync());
152+
}
153+
154+
using (var s = OpenSession())
155+
{
156+
book = await (s.GetAsync<Book>(1));
157+
text = book.ALotOfText;
158+
}
159+
160+
Assert.That(NHibernateUtil.IsPropertyInitialized(book, "ALotOfText"), Is.True);
161+
Assert.That(text, Is.EqualTo("text"));
162+
}
163+
140164
[Test]
141165
public async Task CanGetValueForNonLazyPropertyAsync()
142166
{

‎src/NHibernate.Test/FetchLazyProperties/Address.cs

+2
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@ public class Address
1111
public string City { get; set; }
1212

1313
public string Country { get; set; }
14+
15+
public Continent Continent { get; set; }
1416
}
1517
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace NHibernate.Test.FetchLazyProperties
8+
{
9+
public class Continent
10+
{
11+
public virtual int Id { get; set; }
12+
13+
public virtual string Name { get; set; }
14+
}
15+
}

0 commit comments

Comments
 (0)