NHibernate on WCF Dependency Injection
Posted
by Diego Dias
on Stack Overflow
See other posts from Stack Overflow
or by Diego Dias
Published on 2010-06-17T02:54:01Z
Indexed on
2010/06/17
3:03 UTC
Read the original article
Hit count: 266
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?
© Stack Overflow or respective owner