How to get hold of the current NHibernate.Cfg.Configuration instance.
Posted
by Sandor Drieënhuizen
on Stack Overflow
See other posts from Stack Overflow
or by Sandor Drieënhuizen
Published on 2010-04-29T00:13:11Z
Indexed on
2010/04/29
0:17 UTC
Read the original article
Hit count: 425
nhibernate
|c#
My C# project has repositories that are instantiated using dependency injection.
One of the repository methods needs access to the NHibernate.Cfg.Configuration
instance (to generate the database schema) that was returned when initializing NHibernate.
I cannot pass the configuration to the repository however, because that would break the persistence ignorance principle -- I really don't want to expose any implementation details through the repository interface.
So what I'm looking for is a way of getting hold of the current NHibernate.Cfg.Configuration
instance from within my repository. I have no trouble getting hold of the current session, it's just the configuration that I cannot get hold of.
© Stack Overflow or respective owner