Я получаю сообщение об ошибке:
No CurrentSessionContext configured (set the property current_session_context_class).
Я не уверен, что туда поместить, у меня есть это:
public class NhDbHelper
{
public NhDbHelper()
{
CreateSessionFactory();
}
private ISessionFactory _sessionFactory;
public ISessionFactory SessionFactory
{
get { return _sessionFactory; }
}
private void CreateSessionFactory()
{
_sessionFactory = Fluently
.Configure()
.Database((MsSqlConfiguration.MsSql2008 //
.ConnectionString(@"Server=.\SQLExpress;Database=abc;Uid=sa;Pwd=123;")
.ShowSql()))
.Mappings(m => m.FluentMappings
.AddFromAssemblyOf<UserMap>())
.ExposeConfiguration(cfg => new SchemaExport(cfg).Create(true, true))
.BuildSessionFactory();
}
}
Тогда в моем хранилище я просто используюСвойство SessionFactory в помощнике.