Skip to content

Commit 746bcef

Browse files
committed
Document breaking change for NH-3119 and also fix PocoEntityTuplizer deserialization.
1 parent 6fb0dda commit 746bcef

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

releasenotes.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ Build vNext
44
** Known BREAKING CHANGES from NH4.0.0.Alpha1 to 4.0.0.Alpha1
55

66
Fixed mapping by code behaviour when map child subclasses (see NH-3135 and NH-3269)
7+
8+
The constructor of AbstractComponentTuplizer now behaves like AbstractEntityTuplizer in the way
9+
that it doesn't create the instantiator any more. Custom component tuplizers that derive
10+
directly from AbstractComponentTuplizer need to add this line of code in their constructor:
11+
instantiator = BuildInstantiator(component);
712

813

914
Build 4.0.0.Alpha1

src/NHibernate/Tuple/Entity/PocoEntityTuplizer.cs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ public class PocoEntityTuplizer : AbstractEntityTuplizer
3434
internal void OnDeserialized(StreamingContext context)
3535
{
3636
SetReflectionOptimizer();
37+
38+
if (optimizer != null)
39+
{
40+
// Also set the InstantiationOptimizer on the deserialized PocoInstantiator.
41+
((PocoInstantiator)Instantiator).SetOptimizer(optimizer.InstantiationOptimizer);
42+
}
43+
44+
ClearOptimizerWhenUsingCustomAccessors();
3745
}
3846
protected void SetReflectionOptimizer()
3947
{
@@ -62,10 +70,7 @@ public PocoEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappe
6270

6371
Instantiator = BuildInstantiator(mappedEntity);
6472

65-
if (hasCustomAccessors)
66-
{
67-
optimizer = null;
68-
}
73+
ClearOptimizerWhenUsingCustomAccessors();
6974

7075
proxyValidator = Cfg.Environment.BytecodeProvider.ProxyFactoryFactory.ProxyValidator;
7176
}
@@ -316,5 +321,13 @@ public override EntityMode EntityMode
316321
{
317322
get { return EntityMode.Poco; }
318323
}
324+
325+
protected void ClearOptimizerWhenUsingCustomAccessors()
326+
{
327+
if (hasCustomAccessors)
328+
{
329+
optimizer = null;
330+
}
331+
}
319332
}
320333
}

0 commit comments

Comments
 (0)