summaryrefslogtreecommitdiff
path: root/product/DataAccess/Transactions/SessionFactory.cs
blob: f5a8b646915c05772ea0539d3c22c262bab0267d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using Gorilla.Commons.Utility.Core;

namespace MoMoney.DataAccess.Transactions
{
    public interface ISessionFactory : IFactory<ISession>
    {
    }

    public class SessionFactory : ISessionFactory
    {
        readonly IDatabase database;
        readonly IChangeTrackerFactory factory;

        public SessionFactory(IDatabase database, IChangeTrackerFactory factory)
        {
            this.database = database;
            this.factory = factory;
        }

        public ISession create()
        {
            return new Session(new Transaction(database, factory), database);
        }
    }
}