2010/9/8 Eric <[email protected]>
> A. What is the best way to access the ISessionFactoryImplementor?
>
I will recommend you to create a separated component in the "data.impl"
project ConnectionDisposser, with an interface in the data
project IConnectionDisposer... Pseudo code:
public class ConnectionDisposer : IconnectionDisposer{
public ConnectionDisposer(ISessionFactory sessionFactory){
this.sessionFactory = sessionFactory}
public void DisposeAllConnections(){
foreach(var connection in sessionFactory...)
if(connection.IsOpen...) connection.Close/Dispose.
}
}
> B. In the normal case of Repository<T> in
> "uNHAddins.Examples.SessionManagement", does each repository get the
> same session factory (singleton?) through IoC or a different instance?
>
Yes, BuildSessionFactory is a very expensive operation. You must use one
instance per application.
BTW; Castle default lifestyle for components, is Singleton. So when you
don't see something like
container.REgister(Component.....Lifestyle.Transient) or so... it is
singleton.
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.