@@ -9,9 +9,16 @@ namespace Squiggle.History
9
9
{
10
10
public class HistoryManager
11
11
{
12
+ string connectionString ;
13
+
14
+ public HistoryManager ( string connectionString )
15
+ {
16
+ this . connectionString = connectionString ;
17
+ }
18
+
12
19
public void AddSessionEvent ( Guid sessionId , EventType type , Guid senderId , string senderName , IEnumerable < Guid > recipients , string data )
13
20
{
14
- using ( var repository = new HistoryRepository ( ) )
21
+ using ( var repository = new HistoryRepository ( connectionString ) )
15
22
{
16
23
repository . AddSessionEvent ( sessionId , DateTime . UtcNow , type , senderId , senderName , recipients , data ) ;
17
24
if ( type == EventType . Joined )
@@ -29,50 +36,50 @@ public void AddSessionEvent(Guid sessionId, EventType type, Guid senderId, strin
29
36
30
37
public void AddStatusUpdate ( Guid contactId , string contactName , int status )
31
38
{
32
- using ( var repository = new HistoryRepository ( ) )
39
+ using ( var repository = new HistoryRepository ( connectionString ) )
33
40
repository . AddStatusUpdate ( DateTime . UtcNow , contactId , contactName , status ) ;
34
41
}
35
42
36
43
public IEnumerable < Session > GetSessions ( SessionCriteria criteria )
37
44
{
38
- using ( var repository = new HistoryRepository ( ) )
45
+ using ( var repository = new HistoryRepository ( connectionString ) )
39
46
return repository . GetSessions ( criteria ) ;
40
47
}
41
48
42
49
public Session GetSession ( Guid sessionId )
43
50
{
44
- using ( var repository = new HistoryRepository ( ) )
51
+ using ( var repository = new HistoryRepository ( connectionString ) )
45
52
return repository . GetSession ( sessionId ) ;
46
53
}
47
54
48
55
49
56
public IEnumerable < StatusUpdate > GetStatusUpdates ( StatusCriteria criteria )
50
57
{
51
- using ( var repository = new HistoryRepository ( ) )
58
+ using ( var repository = new HistoryRepository ( connectionString ) )
52
59
return repository . GetStatusUpdates ( criteria ) ;
53
60
}
54
61
55
62
public void ClearChatHistory ( )
56
63
{
57
- using ( var repository = new HistoryRepository ( ) )
64
+ using ( var repository = new HistoryRepository ( connectionString ) )
58
65
repository . ClearChatHistory ( ) ;
59
66
}
60
67
61
68
public void ClearStatusHistory ( )
62
69
{
63
- using ( var repository = new HistoryRepository ( ) )
70
+ using ( var repository = new HistoryRepository ( connectionString ) )
64
71
repository . ClearStatusHistory ( ) ;
65
72
}
66
73
67
74
public void AddSession ( Session newSession , IEnumerable < Participant > participants )
68
75
{
69
- using ( var repository = new HistoryRepository ( ) )
76
+ using ( var repository = new HistoryRepository ( connectionString ) )
70
77
repository . AddSession ( newSession , participants ) ;
71
78
}
72
79
73
80
public void DeleteSessions ( IEnumerable < Guid > sessionIds )
74
81
{
75
- using ( var repository = new HistoryRepository ( ) )
82
+ using ( var repository = new HistoryRepository ( connectionString ) )
76
83
repository . DeleteSessions ( sessionIds ) ;
77
84
}
78
85
}
0 commit comments