/
IUnitOfWork.cs
54 lines (42 loc) · 1.52 KB
/
IUnitOfWork.cs
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
49
50
51
52
53
54
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
namespace Naimad.Infrastructure.Db
{
public interface IUnitOfWork
{
IDataSource<T> GetDataSource<T>() where T : IAggregateRoot;
void SetFlushModeAuto();
void SetFlushModeCommit();
void BeginTransaction();
void BeginTransaction(IsolationLevel isolationLevel);
void RollbackTransaction();
void CommitTransaction();
void CommitTransaction(bool batchMode);
/// <summary>
/// Removes the entity from the session so that no changes will be saved from this point on
/// </summary>
/// <typeparam name="T">Type of entity to detach</typeparam>
/// <param name="entity">Entity being detached</param>
void Detach<T>(T entity);
/// <summary>
/// Will eager load the entity(s)
/// </summary>
void Initialise<T>(T entity);
void Close();
/// <summary>
/// Stops the session from saving any more changes. ie turns flush mode off
/// </summary>
void DoNotSaveAnyMoreChanges();
/// <summary>
/// Dumps all objects in the session so forcing requerying for any entities from there on
/// </summary>
void ClearCache();
bool IsOpen { get; }
void TransactionalFlush();
void TransactionalFlush(IsolationLevel isolationLevel);
void TransactionalFlush(IsolationLevel isolationLevel, bool batchMode);
}
}