25 lines
630 B
C#
25 lines
630 B
C#
using System;
|
|
using System.IO;
|
|
using NHibernate;
|
|
using NHibernate.Cfg;
|
|
|
|
namespace Taloyhtio.GeneralSSO.Server.CodeFiles.Infrastructure.DataAccess.Impl
|
|
{
|
|
public class SessionSource : ISessionSource
|
|
{
|
|
private readonly ISessionFactory sessionFactory;
|
|
|
|
public SessionSource(Configuration configuration)
|
|
{
|
|
sessionFactory = configuration.BuildSessionFactory();
|
|
}
|
|
|
|
public ISession CreateSession()
|
|
{
|
|
var session = sessionFactory.OpenSession(/*interceptor*/);
|
|
session.FlushMode = FlushMode.Commit;
|
|
return session;
|
|
}
|
|
}
|
|
}
|