2
我目前通过静态调用如是否可以在流畅配置中使用不同的CurrentSessionContexts?
SessionConfiguration.GetSessionConfiguration();
建立我的会话配置的方法上面返回一个配置的ISessionFactory:
public static ISessionFactory GetSessionConfiguration()
{
return Fluently.Configure()
.Database(MsSqlConfiguration
.MsSql2005
.ConnectionString(/*...*/)
.ShowSql()
.CurrentSessionContext<WebSessionContext>())
.Mappings(/*etc*/)
.BuildSessionFactory();
}
我寻找到的部分是“CurrentSessionContext < >”。我希望能够根据调用它的应用程序来设置它。大部分时间通过网络应用程序访问这个库,所以上述工作正常。但是,最近我需要在控制台应用程序中使用此层,其中CallSessionContext似乎更合适。
是否可以传递ICurrentSessionContext以便使用?
我试图沿着线的东西:
public static ISessionFactory GetSessionConfiguration<ICurrentSessionContext>
或
public static ISessionFactory GetSessionConfiguration<TSessionContext>
,但还没有任何运气,只是还没有。
任何援助非常感谢!