Is it possible to register ONE type for TWO interface in StructureMap? Look:
public interface IUnitOfWork { }
public interface IUnitOfWork<TSession> : IUnitOfWork { }
public class NHibernateUnitOfWork : IUnitOfWork<ISession> { }
I want to register NHibernateUnitOfWork for both IUnitOfWork and IUnitOfWork<TSession> e.g. one instance of NHibernateUnitOfWork -per http request- be responsible for both IUnitOfWork and IUnitOfWork<TSession>. I use this registry:
For<IUnitOfWork>().HybridHttpOrThreadLocalScoped().Use<NHibernateUnitOfWork>();
For<IUnitOfWork<>>().HybridHttpOrThreadLocalScoped().Use<NHibernateUnitOfWork>();
But I don’t know is this currect or not? Can you help me please?
See the Forward command, as demonstrated in this answer:
https://stackoverflow.com/a/2366838/156533
You just need to change the life cycle, if you don’t want a singleton.