Duplicate
Details
Details
Assignee
Alex Zaytsev
Alex ZaytsevReporter
Daniel Hilgarth
Daniel HilgarthComponents
Affects versions
Priority
Who's Looking?
Open Who's Looking?
Created March 1, 2013 at 2:01 PM
Updated May 7, 2014 at 11:07 AM
Resolved March 21, 2013 at 11:26 AM
The class NHibernate.Tuple.Component.AbstractComponentTuplizer calls the abstract method BuildInstantiator in its constructor.
The derived class NHibernate.Tuple.Component.PocoComponentTuplizer overrides this method and has the following body:
if (optimizer == null)
return new PocoInstantiator(component, null);
return new PocoInstantiator(component, optimizer.InstantiationOptimizer);
optimizer is a field of this class and will be set in the constructor of PocoComponentTuplizer. But at the time this method is called, the constructor didn't yet run.
So, call order is like this:
AbstractComponentTuplizer..ctor -> PocoComponentTuplizer.BuildInstantiator (accesses optimizer) -> PocoComponentTuplizer..ctor (assigns value to optimizer). (That's actually the reason why Visual Studio warns about virtual method calls in constructors)
The result of this is that the reflection optimizer is not used at all to create POCO components.