Skip to content

Commit 6f38e03

Browse files
committed
Adjust value names for SelectMode enum
1 parent a8a6e57 commit 6f38e03

File tree

7 files changed

+24
-14
lines changed

7 files changed

+24
-14
lines changed

src/NHibernate.Test/Async/Criteria/SelectModeTest/SelectModeTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public async Task SelectModeFetchLazyPropertiesAsync()
144144
using (var session = OpenSession())
145145
{
146146
var root = await (session.QueryOver<EntityComplex>()
147-
.Fetch(SelectMode.FetchLazyProperties, ec => ec)
147+
.Fetch(SelectMode.FetchAllLazyProperties, ec => ec)
148148
.Where(ec => ec.LazyProp != null)
149149
.Take(1)
150150
.SingleOrDefaultAsync());
@@ -187,7 +187,7 @@ public async Task SelectModeFetchLazyPropertiesFetchGroupAsync()
187187
using (var session = OpenSession())
188188
{
189189
var root = await (session.QueryOver<EntityComplex>()
190-
.Fetch(SelectMode.FetchProperty, ec => ec.LazyProp, ec => ec.LazyProp2, ec => ec.SameTypeChild.LazyProp2)
190+
.Fetch(SelectMode.FetchLazyPropertyGroup, ec => ec.LazyProp, ec => ec.LazyProp2, ec => ec.SameTypeChild.LazyProp2)
191191
.Where(ec => ec.Id == _parentEntityComplexId)
192192
.SingleOrDefaultAsync());
193193

@@ -315,7 +315,7 @@ public async Task SelectModeFetchLazyPropertiesForEntityJoinAsync()
315315
EntitySimpleChild rootChild = null;
316316
rootChild = await (session.QueryOver(() => rootChild)
317317
.JoinEntityQueryOver(() => parentJoin, Restrictions.Where(() => rootChild.ParentId == parentJoin.Id))
318-
.Fetch(SelectMode.FetchLazyProperties, ec => ec)
318+
.Fetch(SelectMode.FetchAllLazyProperties, ec => ec)
319319
.Take(1)
320320
.SingleOrDefaultAsync());
321321
parentJoin = await (session.LoadAsync<EntityComplex>(rootChild.ParentId));

src/NHibernate.Test/Criteria/SelectModeTest/SelectModeTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public void SelectModeFetchLazyProperties()
133133
using (var session = OpenSession())
134134
{
135135
var root = session.QueryOver<EntityComplex>()
136-
.Fetch(SelectMode.FetchLazyProperties, ec => ec)
136+
.Fetch(SelectMode.FetchAllLazyProperties, ec => ec)
137137
.Where(ec => ec.LazyProp != null)
138138
.Take(1)
139139
.SingleOrDefault();
@@ -176,7 +176,7 @@ public void SelectModeFetchLazyPropertiesFetchGroup()
176176
using (var session = OpenSession())
177177
{
178178
var root = session.QueryOver<EntityComplex>()
179-
.Fetch(SelectMode.FetchProperty, ec => ec.LazyProp, ec => ec.LazyProp2, ec => ec.SameTypeChild.LazyProp2)
179+
.Fetch(SelectMode.FetchLazyPropertyGroup, ec => ec.LazyProp, ec => ec.LazyProp2, ec => ec.SameTypeChild.LazyProp2)
180180
.Where(ec => ec.Id == _parentEntityComplexId)
181181
.SingleOrDefault();
182182

@@ -304,7 +304,7 @@ public void SelectModeFetchLazyPropertiesForEntityJoin()
304304
EntitySimpleChild rootChild = null;
305305
rootChild = session.QueryOver(() => rootChild)
306306
.JoinEntityQueryOver(() => parentJoin, Restrictions.Where(() => rootChild.ParentId == parentJoin.Id))
307-
.Fetch(SelectMode.FetchLazyProperties, ec => ec)
307+
.Fetch(SelectMode.FetchAllLazyProperties, ec => ec)
308308
.Take(1)
309309
.SingleOrDefault();
310310
parentJoin = session.Load<EntityComplex>(rootChild.ParentId);

src/NHibernate/Impl/CriteriaImpl.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ public ICriteria Fetch(SelectMode selectMode, string associationPath, string ali
378378
return this;
379379
}
380380

381-
if (selectMode == SelectMode.FetchProperty)
381+
if (selectMode == SelectMode.FetchLazyPropertyGroup)
382382
{
383383
StringHelper.ParsePathAndPropertyName(associationPath, out associationPath, out var propertyName);
384384
if (_entityFetchLazyProperties.TryGetValue(associationPath, out var propertyNames))

src/NHibernate/Loader/Criteria/CriteriaJoinWalker.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ protected override JoinType GetJoinType(IAssociationType type, FetchMode config,
204204
return base.GetJoinType(type, config, path, pathAlias, lhsTable, lhsColumns, nullable, currentDepth, cascadeStyle);
205205

206206
case SelectMode.Fetch:
207-
case SelectMode.FetchLazyProperties:
208-
case SelectMode.FetchProperty:
207+
case SelectMode.FetchAllLazyProperties:
208+
case SelectMode.FetchLazyPropertyGroup:
209209
case SelectMode.ChildFetch:
210210
case SelectMode.JoinOnly:
211211
IsDuplicateAssociation(lhsTable, lhsColumns, type); //deliberately ignore return value!

src/NHibernate/Loader/JoinWalker.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ private void FillEntityPersisterProperties(int i, OuterJoinableAssociation oj, I
10811081
{
10821082
persisters[i] = persister;
10831083
aliases[i] = oj.RHSAlias;
1084-
EagerPropertyFetches[i] = oj.SelectMode == SelectMode.FetchLazyProperties;
1084+
EagerPropertyFetches[i] = oj.SelectMode == SelectMode.FetchAllLazyProperties;
10851085
ChildFetchEntities[i] = oj.SelectMode == SelectMode.ChildFetch;
10861086
EntityFetchLazyProperties[i] = oj.EntityFetchLazyProperties;
10871087
}
@@ -1149,7 +1149,7 @@ protected static string GetSelectFragment(OuterJoinableAssociation join, string
11491149
join.ShouldFetchCollectionPersister());
11501150
#pragma warning restore 618
11511151

1152-
case SelectMode.FetchLazyProperties:
1152+
case SelectMode.FetchAllLazyProperties:
11531153
#pragma warning disable 618
11541154
return ReflectHelper.CastOrThrow<ISupportSelectModeJoinable>(join.Joinable, "fetch lazy properties")
11551155
.SelectFragment(
@@ -1162,7 +1162,7 @@ protected static string GetSelectFragment(OuterJoinableAssociation join, string
11621162
true);
11631163
#pragma warning restore 618
11641164

1165-
case SelectMode.FetchProperty:
1165+
case SelectMode.FetchLazyPropertyGroup:
11661166
return ReflectHelper.CastOrThrow<ISupportLazyPropsJoinable>(join.Joinable, "fetch lazy property")
11671167
.SelectFragment(
11681168
next?.Joinable,

src/NHibernate/Loader/OuterJoinableAssociation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ internal bool ShouldFetchCollectionPersister()
186186
return JoinType == JoinType.LeftOuterJoin;
187187

188188
case SelectMode.Fetch:
189-
case SelectMode.FetchLazyProperties:
189+
case SelectMode.FetchAllLazyProperties:
190190
return true;
191191

192192
case SelectMode.ChildFetch:

src/NHibernate/SelectMode.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using System;
2+
13
namespace NHibernate
24
{
35
/// <summary>
@@ -18,6 +20,7 @@ public enum SelectMode
1820
/// <summary>
1921
/// Fetch the entity and its lazy properties.
2022
/// </summary>
23+
[Obsolete("Please use FetchAllLazyProperties")]
2124
FetchLazyProperties,
2225

2326
/// <summary>
@@ -41,6 +44,13 @@ public enum SelectMode
4144
/// Fetch lazy property group
4245
/// Note: To fetch single property it must be mapped with unique fetch group (lazy-group)
4346
/// </summary>
44-
FetchProperty,
47+
FetchLazyPropertyGroup,
48+
49+
/// <summary>
50+
/// Fetch the entity and its lazy properties.
51+
/// </summary>
52+
#pragma warning disable 618
53+
FetchAllLazyProperties = FetchLazyProperties,
54+
#pragma warning restore 618
4555
}
4656
}

0 commit comments

Comments
 (0)