From b97348f8d368618fc471be3d7d3b25626f456ffc Mon Sep 17 00:00:00 2001 From: Roman Artiukhin Date: Thu, 29 Sep 2022 13:59:39 +0300 Subject: [PATCH 1/5] Test case --- .../NHSpecificTest/GH3169/FixtureByCode.cs | 77 +++++++++++++++++++ .../NHSpecificTest/GH3169/FixtureByCode.cs | 59 ++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 src/NHibernate.Test/Async/NHSpecificTest/GH3169/FixtureByCode.cs create mode 100644 src/NHibernate.Test/NHSpecificTest/GH3169/FixtureByCode.cs diff --git a/src/NHibernate.Test/Async/NHSpecificTest/GH3169/FixtureByCode.cs b/src/NHibernate.Test/Async/NHSpecificTest/GH3169/FixtureByCode.cs new file mode 100644 index 00000000000..0b7568c508d --- /dev/null +++ b/src/NHibernate.Test/Async/NHSpecificTest/GH3169/FixtureByCode.cs @@ -0,0 +1,77 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by AsyncGenerator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +using System.Collections.Generic; +using NHibernate.Cfg.MappingSchema; +using NHibernate.Mapping.ByCode; +using NHibernate.Transform; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.GH3169 +{ + using System.Threading.Tasks; + [TestFixture] + public class ByCodeFixtureAsync : TestCaseMappingByCode + { + public class ResultDto + { + public string regionCode { get; set; } + } + + protected override HbmMapping GetMappings() + { + var mapper = new ModelMapper(); + return mapper.CompileMappingForAllExplicitlyAddedEntities(); + } + + + [Test] + public async Task CachedQueryWithTransformerAsync() + { + Task> GetCacheableSqlQueryResultsAsync(ISession s) + { + try + { + return s.CreateSQLQuery( + "select 'REGIONCODE' as regionCode ") + .AddScalar("regionCode", NHibernateUtil.String) + .SetResultTransformer(Transformers.AliasToBean()) + .SetCacheable(true) + .ListAsync(); + } + catch (System.Exception ex) + { + return Task.FromException>(ex); + } + } + + using (var session = OpenSession()) + { + using (EnableStatisticsScope()) + { + var l = await (GetCacheableSqlQueryResultsAsync(session)); + Assert.AreEqual(1, l.Count); + //Uncomment if we properly fix caching auto discovery type queries with transformers + //Assert.That(Sfi.Statistics.QueryCacheMissCount, Is.EqualTo(1), "results are expected from DB"); + //Assert.That(Sfi.Statistics.QueryCacheHitCount, Is.EqualTo(0), "results are expected from DB"); + } + + using (EnableStatisticsScope()) + { + var l2 = await (GetCacheableSqlQueryResultsAsync(session)); + Assert.AreEqual(1, l2.Count); + //Uncomment if we properly fix caching auto discovery type queries with transformers + //Assert.That(Sfi.Statistics.QueryCacheMissCount, Is.EqualTo(0), "results are expected from cache"); + //Assert.That(Sfi.Statistics.QueryCacheHitCount, Is.EqualTo(1), "results are expected from cache"); + } + } + } + } +} diff --git a/src/NHibernate.Test/NHSpecificTest/GH3169/FixtureByCode.cs b/src/NHibernate.Test/NHSpecificTest/GH3169/FixtureByCode.cs new file mode 100644 index 00000000000..4a03744540a --- /dev/null +++ b/src/NHibernate.Test/NHSpecificTest/GH3169/FixtureByCode.cs @@ -0,0 +1,59 @@ +using System.Collections.Generic; +using NHibernate.Cfg.MappingSchema; +using NHibernate.Mapping.ByCode; +using NHibernate.Transform; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.GH3169 +{ + [TestFixture] + public class ByCodeFixture : TestCaseMappingByCode + { + public class ResultDto + { + public string regionCode { get; set; } + } + + protected override HbmMapping GetMappings() + { + var mapper = new ModelMapper(); + return mapper.CompileMappingForAllExplicitlyAddedEntities(); + } + + + [Test] + public void CachedQueryWithTransformer() + { + IList GetCacheableSqlQueryResults(ISession s) + { + return s.CreateSQLQuery( + "select 'REGIONCODE' as regionCode ") + .AddScalar("regionCode", NHibernateUtil.String) + .SetResultTransformer(Transformers.AliasToBean()) + .SetCacheable(true) + .List(); + } + + using (var session = OpenSession()) + { + using (EnableStatisticsScope()) + { + var l = GetCacheableSqlQueryResults(session); + Assert.AreEqual(1, l.Count); + //Uncomment if we properly fix caching auto discovery type queries with transformers + //Assert.That(Sfi.Statistics.QueryCacheMissCount, Is.EqualTo(1), "results are expected from DB"); + //Assert.That(Sfi.Statistics.QueryCacheHitCount, Is.EqualTo(0), "results are expected from DB"); + } + + using (EnableStatisticsScope()) + { + var l2 = GetCacheableSqlQueryResults(session); + Assert.AreEqual(1, l2.Count); + //Uncomment if we properly fix caching auto discovery type queries with transformers + //Assert.That(Sfi.Statistics.QueryCacheMissCount, Is.EqualTo(0), "results are expected from cache"); + //Assert.That(Sfi.Statistics.QueryCacheHitCount, Is.EqualTo(1), "results are expected from cache"); + } + } + } + } +} From 83f502f4e74d417d0f6fe81ea19728d954421a81 Mon Sep 17 00:00:00 2001 From: Roman Artiukhin Date: Thu, 29 Sep 2022 14:18:58 +0300 Subject: [PATCH 2/5] Skip caching for auto discovery type queries with result transformer --- src/NHibernate/Loader/Loader.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/NHibernate/Loader/Loader.cs b/src/NHibernate/Loader/Loader.cs index 8069cc9a544..ba56146dbbd 100644 --- a/src/NHibernate/Loader/Loader.cs +++ b/src/NHibernate/Loader/Loader.cs @@ -1829,7 +1829,8 @@ protected IList List(ISessionImplementor session, QueryParameters queryParameter internal bool IsCacheable(QueryParameters queryParameters) { - return _factory.Settings.IsQueryCacheEnabled && queryParameters.Cacheable; + return _factory.Settings.IsQueryCacheEnabled && queryParameters.Cacheable + && !(queryParameters.HasAutoDiscoverScalarTypes && queryParameters.ResultTransformer != null); } private IList ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters) From ec33689087e0af6d23371f0cc1f4a7271a35214d Mon Sep 17 00:00:00 2001 From: Roman Artiukhin Date: Fri, 30 Sep 2022 16:18:03 +0300 Subject: [PATCH 3/5] Fix test and review suggestions --- .../NHSpecificTest/GH3169/FixtureByCode.cs | 42 +++++++++++++++++-- .../NHSpecificTest/GH3169/FixtureByCode.cs | 42 +++++++++++++++++-- 2 files changed, 76 insertions(+), 8 deletions(-) diff --git a/src/NHibernate.Test/Async/NHSpecificTest/GH3169/FixtureByCode.cs b/src/NHibernate.Test/Async/NHSpecificTest/GH3169/FixtureByCode.cs index 0b7568c508d..26a67ab4c75 100644 --- a/src/NHibernate.Test/Async/NHSpecificTest/GH3169/FixtureByCode.cs +++ b/src/NHibernate.Test/Async/NHSpecificTest/GH3169/FixtureByCode.cs @@ -20,17 +20,51 @@ namespace NHibernate.Test.NHSpecificTest.GH3169 [TestFixture] public class ByCodeFixtureAsync : TestCaseMappingByCode { - public class ResultDto + class ResultDto { public string regionCode { get; set; } } + class Entity + { + public virtual int Id { get; set; } + public virtual string Name { get; set; } + } + protected override HbmMapping GetMappings() { var mapper = new ModelMapper(); + mapper.Class(rc => + { + rc.Table("Entity"); + rc.Id(x => x.Id, m => m.Generator(Generators.Native)); + rc.Property(x => x.Name); + }); + return mapper.CompileMappingForAllExplicitlyAddedEntities(); } + protected override void OnSetUp() + { + using (var session = OpenSession()) + using (var transaction = session.BeginTransaction()) + { + var e1 = new Entity { Name = "Bob" }; + session.Save(e1); + + transaction.Commit(); + } + } + + protected override void OnTearDown() + { + using (var session = OpenSession()) + using (var transaction = session.BeginTransaction()) + { + session.CreateQuery("delete from System.Object").ExecuteUpdate(); + transaction.Commit(); + } + } [Test] public async Task CachedQueryWithTransformerAsync() @@ -40,7 +74,7 @@ Task> GetCacheableSqlQueryResultsAsync(ISession s) try { return s.CreateSQLQuery( - "select 'REGIONCODE' as regionCode ") + "select Name as regionCode from Entity") .AddScalar("regionCode", NHibernateUtil.String) .SetResultTransformer(Transformers.AliasToBean()) .SetCacheable(true) @@ -58,7 +92,7 @@ Task> GetCacheableSqlQueryResultsAsync(ISession s) { var l = await (GetCacheableSqlQueryResultsAsync(session)); Assert.AreEqual(1, l.Count); - //Uncomment if we properly fix caching auto discovery type queries with transformers + //TODO: Uncomment if we properly fix caching auto discovery type queries with transformers //Assert.That(Sfi.Statistics.QueryCacheMissCount, Is.EqualTo(1), "results are expected from DB"); //Assert.That(Sfi.Statistics.QueryCacheHitCount, Is.EqualTo(0), "results are expected from DB"); } @@ -67,7 +101,7 @@ Task> GetCacheableSqlQueryResultsAsync(ISession s) { var l2 = await (GetCacheableSqlQueryResultsAsync(session)); Assert.AreEqual(1, l2.Count); - //Uncomment if we properly fix caching auto discovery type queries with transformers + //TODO: Uncomment if we properly fix caching auto discovery type queries with transformers //Assert.That(Sfi.Statistics.QueryCacheMissCount, Is.EqualTo(0), "results are expected from cache"); //Assert.That(Sfi.Statistics.QueryCacheHitCount, Is.EqualTo(1), "results are expected from cache"); } diff --git a/src/NHibernate.Test/NHSpecificTest/GH3169/FixtureByCode.cs b/src/NHibernate.Test/NHSpecificTest/GH3169/FixtureByCode.cs index 4a03744540a..5a4b950fdd7 100644 --- a/src/NHibernate.Test/NHSpecificTest/GH3169/FixtureByCode.cs +++ b/src/NHibernate.Test/NHSpecificTest/GH3169/FixtureByCode.cs @@ -9,17 +9,51 @@ namespace NHibernate.Test.NHSpecificTest.GH3169 [TestFixture] public class ByCodeFixture : TestCaseMappingByCode { - public class ResultDto + class ResultDto { public string regionCode { get; set; } } + class Entity + { + public virtual int Id { get; set; } + public virtual string Name { get; set; } + } + protected override HbmMapping GetMappings() { var mapper = new ModelMapper(); + mapper.Class(rc => + { + rc.Table("Entity"); + rc.Id(x => x.Id, m => m.Generator(Generators.Native)); + rc.Property(x => x.Name); + }); + return mapper.CompileMappingForAllExplicitlyAddedEntities(); } + protected override void OnSetUp() + { + using (var session = OpenSession()) + using (var transaction = session.BeginTransaction()) + { + var e1 = new Entity { Name = "Bob" }; + session.Save(e1); + + transaction.Commit(); + } + } + + protected override void OnTearDown() + { + using (var session = OpenSession()) + using (var transaction = session.BeginTransaction()) + { + session.CreateQuery("delete from System.Object").ExecuteUpdate(); + transaction.Commit(); + } + } [Test] public void CachedQueryWithTransformer() @@ -27,7 +61,7 @@ public void CachedQueryWithTransformer() IList GetCacheableSqlQueryResults(ISession s) { return s.CreateSQLQuery( - "select 'REGIONCODE' as regionCode ") + "select Name as regionCode from Entity") .AddScalar("regionCode", NHibernateUtil.String) .SetResultTransformer(Transformers.AliasToBean()) .SetCacheable(true) @@ -40,7 +74,7 @@ IList GetCacheableSqlQueryResults(ISession s) { var l = GetCacheableSqlQueryResults(session); Assert.AreEqual(1, l.Count); - //Uncomment if we properly fix caching auto discovery type queries with transformers + //TODO: Uncomment if we properly fix caching auto discovery type queries with transformers //Assert.That(Sfi.Statistics.QueryCacheMissCount, Is.EqualTo(1), "results are expected from DB"); //Assert.That(Sfi.Statistics.QueryCacheHitCount, Is.EqualTo(0), "results are expected from DB"); } @@ -49,7 +83,7 @@ IList GetCacheableSqlQueryResults(ISession s) { var l2 = GetCacheableSqlQueryResults(session); Assert.AreEqual(1, l2.Count); - //Uncomment if we properly fix caching auto discovery type queries with transformers + //TODO: Uncomment if we properly fix caching auto discovery type queries with transformers //Assert.That(Sfi.Statistics.QueryCacheMissCount, Is.EqualTo(0), "results are expected from cache"); //Assert.That(Sfi.Statistics.QueryCacheHitCount, Is.EqualTo(1), "results are expected from cache"); } From 9e5ae9c4bc64f277c0dfaf1cfc8aa500a351452e Mon Sep 17 00:00:00 2001 From: Roman Artiukhin Date: Sat, 1 Oct 2022 14:37:03 +0300 Subject: [PATCH 4/5] Review changes --- .../NHSpecificTest/GH3169/FixtureByCode.cs | 111 ------------------ .../SqlTest/Query/NativeSQLQueriesFixture.cs | 50 ++++++++ .../NHSpecificTest/GH3169/FixtureByCode.cs | 93 --------------- .../SqlTest/Query/NativeSQLQueriesFixture.cs | 50 ++++++++ 4 files changed, 100 insertions(+), 204 deletions(-) delete mode 100644 src/NHibernate.Test/Async/NHSpecificTest/GH3169/FixtureByCode.cs delete mode 100644 src/NHibernate.Test/NHSpecificTest/GH3169/FixtureByCode.cs diff --git a/src/NHibernate.Test/Async/NHSpecificTest/GH3169/FixtureByCode.cs b/src/NHibernate.Test/Async/NHSpecificTest/GH3169/FixtureByCode.cs deleted file mode 100644 index 26a67ab4c75..00000000000 --- a/src/NHibernate.Test/Async/NHSpecificTest/GH3169/FixtureByCode.cs +++ /dev/null @@ -1,111 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by AsyncGenerator. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - - -using System.Collections.Generic; -using NHibernate.Cfg.MappingSchema; -using NHibernate.Mapping.ByCode; -using NHibernate.Transform; -using NUnit.Framework; - -namespace NHibernate.Test.NHSpecificTest.GH3169 -{ - using System.Threading.Tasks; - [TestFixture] - public class ByCodeFixtureAsync : TestCaseMappingByCode - { - class ResultDto - { - public string regionCode { get; set; } - } - - class Entity - { - public virtual int Id { get; set; } - public virtual string Name { get; set; } - } - - protected override HbmMapping GetMappings() - { - var mapper = new ModelMapper(); - mapper.Class(rc => - { - rc.Table("Entity"); - rc.Id(x => x.Id, m => m.Generator(Generators.Native)); - rc.Property(x => x.Name); - }); - - return mapper.CompileMappingForAllExplicitlyAddedEntities(); - } - - protected override void OnSetUp() - { - using (var session = OpenSession()) - using (var transaction = session.BeginTransaction()) - { - var e1 = new Entity { Name = "Bob" }; - session.Save(e1); - - transaction.Commit(); - } - } - - protected override void OnTearDown() - { - using (var session = OpenSession()) - using (var transaction = session.BeginTransaction()) - { - session.CreateQuery("delete from System.Object").ExecuteUpdate(); - transaction.Commit(); - } - } - - [Test] - public async Task CachedQueryWithTransformerAsync() - { - Task> GetCacheableSqlQueryResultsAsync(ISession s) - { - try - { - return s.CreateSQLQuery( - "select Name as regionCode from Entity") - .AddScalar("regionCode", NHibernateUtil.String) - .SetResultTransformer(Transformers.AliasToBean()) - .SetCacheable(true) - .ListAsync(); - } - catch (System.Exception ex) - { - return Task.FromException>(ex); - } - } - - using (var session = OpenSession()) - { - using (EnableStatisticsScope()) - { - var l = await (GetCacheableSqlQueryResultsAsync(session)); - Assert.AreEqual(1, l.Count); - //TODO: Uncomment if we properly fix caching auto discovery type queries with transformers - //Assert.That(Sfi.Statistics.QueryCacheMissCount, Is.EqualTo(1), "results are expected from DB"); - //Assert.That(Sfi.Statistics.QueryCacheHitCount, Is.EqualTo(0), "results are expected from DB"); - } - - using (EnableStatisticsScope()) - { - var l2 = await (GetCacheableSqlQueryResultsAsync(session)); - Assert.AreEqual(1, l2.Count); - //TODO: Uncomment if we properly fix caching auto discovery type queries with transformers - //Assert.That(Sfi.Statistics.QueryCacheMissCount, Is.EqualTo(0), "results are expected from cache"); - //Assert.That(Sfi.Statistics.QueryCacheHitCount, Is.EqualTo(1), "results are expected from cache"); - } - } - } - } -} diff --git a/src/NHibernate.Test/Async/SqlTest/Query/NativeSQLQueriesFixture.cs b/src/NHibernate.Test/Async/SqlTest/Query/NativeSQLQueriesFixture.cs index e0bc9034324..37fb132d143 100644 --- a/src/NHibernate.Test/Async/SqlTest/Query/NativeSQLQueriesFixture.cs +++ b/src/NHibernate.Test/Async/SqlTest/Query/NativeSQLQueriesFixture.cs @@ -282,6 +282,56 @@ Task GetCacheableSqlQueryResultsAsync() } } + class ResultDto + { + public string regionCode { get; set; } + } + + [Test(Description = "GH-3169")] + public async Task CacheableScalarSQLQueryWithTransformerAsync() + { + Organization ifa = new Organization("IFA"); + + using (ISession s = OpenSession()) + using (ITransaction t = s.BeginTransaction()) + { + await (s.SaveAsync(ifa)); + await (t.CommitAsync()); + } + + async Task AssertQueryAsync(bool fromCache) + { + using (var s = OpenSession()) + using (var t = s.BeginTransaction()) + using (EnableStatisticsScope()) + { + var l = await (s.CreateSQLQuery("select org.NAME as regionCode from ORGANIZATION org") + .AddScalar("regionCode", NHibernateUtil.String) + .SetResultTransformer(Transformers.AliasToBean()) + .SetCacheable(true) + .ListAsync()); + await (t.CommitAsync()); + + Assert.AreEqual(1, l.Count); + //TODO: Uncomment if we properly fix caching auto discovery type queries with transformers + // var msg = "results are expected from " + (fromCache ? "cache" : "DB"); + // Assert.That(Sfi.Statistics.QueryCacheMissCount, Is.EqualTo(fromCache ? 0 : 1), msg); + // Assert.That(Sfi.Statistics.QueryCacheHitCount, Is.EqualTo(fromCache ? 1 : 0), msg); + } + } + + + await (AssertQueryAsync(false)); + await (AssertQueryAsync(true)); + + using (var s = OpenSession()) + using (var t = s.BeginTransaction()) + { + await (s.DeleteAsync(ifa)); + await (t.CommitAsync()); + } + } + [Test] public async Task ResultSetMappingDefinitionAsync() { diff --git a/src/NHibernate.Test/NHSpecificTest/GH3169/FixtureByCode.cs b/src/NHibernate.Test/NHSpecificTest/GH3169/FixtureByCode.cs deleted file mode 100644 index 5a4b950fdd7..00000000000 --- a/src/NHibernate.Test/NHSpecificTest/GH3169/FixtureByCode.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System.Collections.Generic; -using NHibernate.Cfg.MappingSchema; -using NHibernate.Mapping.ByCode; -using NHibernate.Transform; -using NUnit.Framework; - -namespace NHibernate.Test.NHSpecificTest.GH3169 -{ - [TestFixture] - public class ByCodeFixture : TestCaseMappingByCode - { - class ResultDto - { - public string regionCode { get; set; } - } - - class Entity - { - public virtual int Id { get; set; } - public virtual string Name { get; set; } - } - - protected override HbmMapping GetMappings() - { - var mapper = new ModelMapper(); - mapper.Class(rc => - { - rc.Table("Entity"); - rc.Id(x => x.Id, m => m.Generator(Generators.Native)); - rc.Property(x => x.Name); - }); - - return mapper.CompileMappingForAllExplicitlyAddedEntities(); - } - - protected override void OnSetUp() - { - using (var session = OpenSession()) - using (var transaction = session.BeginTransaction()) - { - var e1 = new Entity { Name = "Bob" }; - session.Save(e1); - - transaction.Commit(); - } - } - - protected override void OnTearDown() - { - using (var session = OpenSession()) - using (var transaction = session.BeginTransaction()) - { - session.CreateQuery("delete from System.Object").ExecuteUpdate(); - transaction.Commit(); - } - } - - [Test] - public void CachedQueryWithTransformer() - { - IList GetCacheableSqlQueryResults(ISession s) - { - return s.CreateSQLQuery( - "select Name as regionCode from Entity") - .AddScalar("regionCode", NHibernateUtil.String) - .SetResultTransformer(Transformers.AliasToBean()) - .SetCacheable(true) - .List(); - } - - using (var session = OpenSession()) - { - using (EnableStatisticsScope()) - { - var l = GetCacheableSqlQueryResults(session); - Assert.AreEqual(1, l.Count); - //TODO: Uncomment if we properly fix caching auto discovery type queries with transformers - //Assert.That(Sfi.Statistics.QueryCacheMissCount, Is.EqualTo(1), "results are expected from DB"); - //Assert.That(Sfi.Statistics.QueryCacheHitCount, Is.EqualTo(0), "results are expected from DB"); - } - - using (EnableStatisticsScope()) - { - var l2 = GetCacheableSqlQueryResults(session); - Assert.AreEqual(1, l2.Count); - //TODO: Uncomment if we properly fix caching auto discovery type queries with transformers - //Assert.That(Sfi.Statistics.QueryCacheMissCount, Is.EqualTo(0), "results are expected from cache"); - //Assert.That(Sfi.Statistics.QueryCacheHitCount, Is.EqualTo(1), "results are expected from cache"); - } - } - } - } -} diff --git a/src/NHibernate.Test/SqlTest/Query/NativeSQLQueriesFixture.cs b/src/NHibernate.Test/SqlTest/Query/NativeSQLQueriesFixture.cs index 6cfe83845e3..73845ae91c7 100644 --- a/src/NHibernate.Test/SqlTest/Query/NativeSQLQueriesFixture.cs +++ b/src/NHibernate.Test/SqlTest/Query/NativeSQLQueriesFixture.cs @@ -264,6 +264,56 @@ IList GetCacheableSqlQueryResults() } } + class ResultDto + { + public string regionCode { get; set; } + } + + [Test(Description = "GH-3169")] + public void CacheableScalarSQLQueryWithTransformer() + { + Organization ifa = new Organization("IFA"); + + using (ISession s = OpenSession()) + using (ITransaction t = s.BeginTransaction()) + { + s.Save(ifa); + t.Commit(); + } + + void AssertQuery(bool fromCache) + { + using (var s = OpenSession()) + using (var t = s.BeginTransaction()) + using (EnableStatisticsScope()) + { + var l = s.CreateSQLQuery("select org.NAME as regionCode from ORGANIZATION org") + .AddScalar("regionCode", NHibernateUtil.String) + .SetResultTransformer(Transformers.AliasToBean()) + .SetCacheable(true) + .List(); + t.Commit(); + + Assert.AreEqual(1, l.Count); + //TODO: Uncomment if we properly fix caching auto discovery type queries with transformers + // var msg = "results are expected from " + (fromCache ? "cache" : "DB"); + // Assert.That(Sfi.Statistics.QueryCacheMissCount, Is.EqualTo(fromCache ? 0 : 1), msg); + // Assert.That(Sfi.Statistics.QueryCacheHitCount, Is.EqualTo(fromCache ? 1 : 0), msg); + } + } + + + AssertQuery(false); + AssertQuery(true); + + using (var s = OpenSession()) + using (var t = s.BeginTransaction()) + { + s.Delete(ifa); + t.Commit(); + } + } + [Test] public void ResultSetMappingDefinition() { From c700c5a2847244205345d9f05968b16d87740c99 Mon Sep 17 00:00:00 2001 From: Roman Artiukhin Date: Mon, 3 Oct 2022 14:44:53 +0300 Subject: [PATCH 5/5] Whitespaces --- .../Async/SqlTest/Query/NativeSQLQueriesFixture.cs | 1 - src/NHibernate.Test/SqlTest/Query/NativeSQLQueriesFixture.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/src/NHibernate.Test/Async/SqlTest/Query/NativeSQLQueriesFixture.cs b/src/NHibernate.Test/Async/SqlTest/Query/NativeSQLQueriesFixture.cs index 37fb132d143..5ef4ebad9d8 100644 --- a/src/NHibernate.Test/Async/SqlTest/Query/NativeSQLQueriesFixture.cs +++ b/src/NHibernate.Test/Async/SqlTest/Query/NativeSQLQueriesFixture.cs @@ -320,7 +320,6 @@ async Task AssertQueryAsync(bool fromCache) } } - await (AssertQueryAsync(false)); await (AssertQueryAsync(true)); diff --git a/src/NHibernate.Test/SqlTest/Query/NativeSQLQueriesFixture.cs b/src/NHibernate.Test/SqlTest/Query/NativeSQLQueriesFixture.cs index 73845ae91c7..80eeb3c4c73 100644 --- a/src/NHibernate.Test/SqlTest/Query/NativeSQLQueriesFixture.cs +++ b/src/NHibernate.Test/SqlTest/Query/NativeSQLQueriesFixture.cs @@ -302,7 +302,6 @@ void AssertQuery(bool fromCache) } } - AssertQuery(false); AssertQuery(true);