NHibernate on WCF Dependency Injection
- by Diego Dias
Hi,
I would like of inject a wrapper of my sessionfactory in my wcf service, but my service is in other server and I want set nhibernate in my site asp.net.
I have a interface as:
public interface ISessionBuilder
{
  ISession Current{get;};
  void Close();
}
public class SessionBuilder : ISessionBuilder
{
  static SessionBuilder()
  {
    Initialize();
  }
  public ISession Current{ get; private set; }
  public void Close()
  {
     //aqui eu fecho a session
  }
  private static void Initialize()
  {
    //aqui eu configuro o NHibernate
  }
}
I want to be able of set SessionBuilder in the site asp.net and inject this implementation in my wcf Service where I have my repositories which will consume SessionBuilder to query my database.
Anyone have some sugestion?