summaryrefslogtreecommitdiff
path: root/product/database/db4o/ObjectDatabaseConnection.cs
blob: 7149d255ddd17b9bafb1351009f7a4219286bf61 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Collections.Generic;
using Db4objects.Db4o;
using momoney.database.transactions;

namespace momoney.database.db4o
{
    public class ObjectDatabaseConnection : DatabaseConnection
    {
        readonly IObjectContainer container;

        public ObjectDatabaseConnection(IObjectContainer container)
        {
            this.container = container;
        }

        public void Dispose()
        {
            container.Close();
            container.Dispose();
        }

        public IEnumerable<T> query<T>()
        {
            return container.Query<T>();
        }

        public IEnumerable<T> query<T>(Predicate<T> predicate)
        {
            return container.Query(predicate);
        }

        public void delete<T>(T entity)
        {
            container.Delete(entity);
        }

        public void commit()
        {
            container.Commit();
        }

        public void store<T>(T entity)
        {
            container.Store(entity);
        }
    }
}