I'm currently setting up my session configuration via a static call such as
SessionConfiguration.GetSessionConfiguration();
The method above returns a configured ISessionFactory:
public static ISessionFactory GetSessionConfiguration()
{
return Fluently.Configure()
.Database(MsSqlConfiguration
.MsSql2005
.ConnectionString(/*...*/)
.ShowSql()
.CurrentSessionContext<WebSessionContext>())
.Mappings(/*etc*/)
.BuildSessionFactory();
}
The part I'm looking into is "CurrentSessionContext<>". I'd like to be able to set this based on the application that is calling it. Most of the time this library is accessed via web app, so the above works fine. However, recently I had a need to use this layer in a console application, where CallSessionContext seemed more appropriate.
Is it possible to pass an ICurrentSessionContext to be used in place?
I've tried something along the lines of:
public static ISessionFactory GetSessionConfiguration<ICurrentSessionContext>
or
public static ISessionFactory GetSessionConfiguration<TSessionContext>
but haven't had any luck just yet.
Any assistance is greatly appreciated!