Hello,

I am working through Fluent NHibernate and have bumped into a peculiar
issue. It seems that instances of my domain model are being created,
via the default constructor.

I can understand a certain amount of handshaking with the domain
model, proxy management, etc, but what's the problem with using
reflection instead of activating a new instance?

I've got a stack trace along these lines:

> Football.dll!Football.Models.GameSituation.Initialize() Line 927 C#
  Football.dll!Football.Models.GameSituation.GameSituation() Line 905
+ 0x9 bytes C#
  [External Code]
  
FluentNHibernate.dll!FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory()
Line 230 + 0x18 bytes C#
  
Football.Data.dll!Football.Data.Repository.Hibernate.NHibernateSessionFactoryManagerBase.CreateFactory()
Line 131 + 0xb bytes C#
  
Kingdom.Repository.dll!Kingdom.Repository.SessionFactoryManagerBase<NHibernate.ISessionFactory>.Factory.get()
Line 37 + 0x1a bytes C#
  
Football.Migrator.exe!Football.Migrator.Program.PlanWork(System.Action<Kingdom.Repository.IRepository>
workPlan) Line 39 + 0xe bytes C#
  Football.Migrator.exe!Football.Migrator.Program.Main(string[] args)
Line 66 + 0x36 bytes C#
  [External Code]

With the external code being to the NHibernate call via Fluent.

/// <summary>
/// Instantiate a new <see cref="ISessionFactory" />, using the
properties and mappings in this
/// configuration. The <see cref="ISessionFactory" /> will be
immutable, so changes made to the
/// configuration after building the <see cref="ISessionFactory" />
will not affect it.
/// </summary>
/// <returns>An <see cref="ISessionFactory" /> instance.</returns>
public ISessionFactory BuildSessionFactory()
{
ConfigureProxyFactoryFactory();
SecondPassCompile();
Validate();
Environment.VerifyProperties(properties);
Settings settings = BuildSettings();

// Ok, don't need schemas anymore, so free them
Schemas = null;

return new SessionFactoryImpl(this, mapping, settings,
GetInitializedEventListeners());
}

Without diving into the specifics in this method, calling for
suggestions. Is there a way to disable this "handshake", minimum, i.e.
via validation environment variables? Or better yet, use reflection
instead of object activation.

Suggestions?

Thank you...

Regards,

Michael Powell

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to