|
| 1 | +//------------------------------------------------------------------------------ |
| 2 | +// <auto-generated> |
| 3 | +// This code was generated by AsyncGenerator. |
| 4 | +// |
| 5 | +// Changes to this file may cause incorrect behavior and will be lost if |
| 6 | +// the code is regenerated. |
| 7 | +// </auto-generated> |
| 8 | +//------------------------------------------------------------------------------ |
| 9 | + |
| 10 | + |
| 11 | +using NHibernate.Cfg; |
| 12 | +using NHibernate.Cfg.MappingSchema; |
| 13 | +using NHibernate.Mapping.ByCode; |
| 14 | +using NUnit.Framework; |
| 15 | + |
| 16 | +namespace NHibernate.Test.NHSpecificTest.GH3215 |
| 17 | +{ |
| 18 | + using System.Threading.Tasks; |
| 19 | + [TestFixture] |
| 20 | + public class ByCodeFixtureAsync : TestCaseMappingByCode |
| 21 | + { |
| 22 | + protected override HbmMapping GetMappings() |
| 23 | + { |
| 24 | + var mapper = new ModelMapper(); |
| 25 | + |
| 26 | + mapper.Class<Member>(rc => |
| 27 | + { |
| 28 | + rc.Id(x => x.Code); |
| 29 | + rc.Property(x => x.Name); |
| 30 | + rc.Property(x => x.Date); |
| 31 | + }); |
| 32 | + |
| 33 | + mapper.Class<Request>(rc => |
| 34 | + { |
| 35 | + rc.Id(x => x.Id, m => m.Generator(Generators.GuidComb)); |
| 36 | + rc.ManyToOne(x => x.Member); |
| 37 | + }); |
| 38 | + return mapper.CompileMappingForAllExplicitlyAddedEntities(); |
| 39 | + } |
| 40 | + |
| 41 | + protected override void Configure(Configuration configuration) |
| 42 | + { |
| 43 | + base.Configure(configuration); |
| 44 | + configuration.SetProperty(Environment.Hbm2ddlKeyWords, "auto-quote"); |
| 45 | + } |
| 46 | + |
| 47 | + [Test] |
| 48 | + public async Task CountDistinctWithReservedWordsAsync() |
| 49 | + { |
| 50 | + using (var session = OpenSession()) |
| 51 | + { |
| 52 | + var hql = "select Count(DISTINCT r.Member.id), Count(DISTINCT Date(r.Member.Date)) from Request r"; |
| 53 | + var result = await (session.CreateQuery(hql).ListAsync()); |
| 54 | + |
| 55 | + Assert.That(result, Has.Count.EqualTo(1)); |
| 56 | + } |
| 57 | + } |
| 58 | + } |
| 59 | +} |
0 commit comments