Skip to content

Commit 4784096

Browse files
author
Jeff Hagen
committed
fix broken tests
1 parent fec83a6 commit 4784096

File tree

8 files changed

+14
-7
lines changed

8 files changed

+14
-7
lines changed

src/NHibernate.Test/Async/QueryTranslator/CustomQueryLoaderFixture.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ internal sealed class CustomQueryLoaderFixtureAsync : TestCase
4242
"Northwind.Mappings.TimeSheet.hbm.xml",
4343
"Northwind.Mappings.Animal.hbm.xml",
4444
"Northwind.Mappings.Patient.hbm.xml",
45-
"Northwind.Mappings.NumericEntity.hbm.xml"
45+
"Northwind.Mappings.NumericEntity.hbm.xml",
46+
"Northwind.Mappings.CompositeIdEntity.hbm.xml"
4647
};
4748

4849
protected override string MappingsAssembly => "NHibernate.DomainModel";

src/NHibernate.Test/Criteria/ReadonlyTests/CriteriaNorthwindReadonlyTestCase.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ protected override string[] Mappings
3232
"Northwind.Mappings.User.hbm.xml",
3333
"Northwind.Mappings.TimeSheet.hbm.xml",
3434
"Northwind.Mappings.Animal.hbm.xml",
35-
"Northwind.Mappings.Patient.hbm.xml"
35+
"Northwind.Mappings.Patient.hbm.xml",
36+
"Northwind.Mappings.CompositeIdEntity.hbm.xml"
3637
};
3738
}
3839
}
Binary file not shown.

src/NHibernate.Test/DbScripts/MsSql2012DialectLinqReadonlyCreateScript.sql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,8 @@ SET IDENTITY_INSERT [dbo].[AnotherEntity] ON
161161
INSERT [dbo].[AnotherEntity] ([Id], [Output]) VALUES (1, N'output')
162162
INSERT [dbo].[AnotherEntity] ([Id], [Input]) VALUES (2, N'input')
163163
INSERT [dbo].[AnotherEntity] ([Id], [Input], [Output]) VALUES (3, N'i/o', N'i/o')
164-
INSERT [dbo].[AnotherEntity] ([Id], [Input], [Output]) VALUES (4, N'input', N'output')
164+
INSERT [dbo].[AnotherEntity] ([Id], [Input], [Output], [CompositeObjectId], [CompositeTenantId]) VALUES (4, N'input', N'output', 1, 10)
165165
INSERT [dbo].[AnotherEntity] ([Id], [Input], [Output]) VALUES (5, NULL, NULL)
166-
INSERT [dbo].[AnotherEntity] ([Id], [Input], [Output], [CompositeObjectId], [CompositeTenantId]) VALUES (6, N'in', N'out', 1, 10)
167166
SET IDENTITY_INSERT [dbo].[AnotherEntity] OFF
168167
/****** Object: Table [dbo].[CompositeIdEntity] ******/
169168
SET ANSI_NULLS ON
Binary file not shown.

src/NHibernate.Test/Linq/LinqReadonlyTestsContext.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ private IEnumerable<string> Mappings
4444
"Northwind.Mappings.TimeSheet.hbm.xml",
4545
"Northwind.Mappings.Animal.hbm.xml",
4646
"Northwind.Mappings.Patient.hbm.xml",
47-
"Northwind.Mappings.NumericEntity.hbm.xml"
47+
"Northwind.Mappings.NumericEntity.hbm.xml",
48+
"Northwind.Mappings.CompositeIdEntity.hbm.xml"
4849
};
4950
}
5051
}

src/NHibernate.Test/QueryTranslator/CustomQueryLoaderFixture.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ internal sealed class CustomQueryLoaderFixture : TestCase
3030
"Northwind.Mappings.TimeSheet.hbm.xml",
3131
"Northwind.Mappings.Animal.hbm.xml",
3232
"Northwind.Mappings.Patient.hbm.xml",
33-
"Northwind.Mappings.NumericEntity.hbm.xml"
33+
"Northwind.Mappings.NumericEntity.hbm.xml",
34+
"Northwind.Mappings.CompositeIdEntity.hbm.xml"
3435
};
3536

3637
protected override string MappingsAssembly => "NHibernate.DomainModel";

src/NHibernate/Linq/ReWriters/AddJoinsReWriter.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,18 @@ bool IIsEntityDecider.IsEntity(MemberExpression expression, out bool isIdentifie
9797
if (ExpressionsHelper.TryGetMappedType(_sessionFactory, expression, out var mappedType, out var entityPersister, out var componentType, out var memberPath))
9898
{
9999
isIdentifier = IsIdentifierPath(entityPersister, componentType, memberPath);
100-
return mappedType.IsEntityType;
100+
return mappedType?.IsEntityType == true;
101101
}
102102
isIdentifier = false;
103103
return false;
104104
}
105105

106106
bool IsIdentifierPath(IEntityPersister entityPersister, IAbstractComponentType componentType, string memberPath)
107107
{
108+
if (entityPersister == null)
109+
{
110+
return false;
111+
}
108112
if (entityPersister.IdentifierPropertyName == memberPath)
109113
{
110114
return true;

0 commit comments

Comments
 (0)