@@ -9,9 +9,16 @@ namespace Squiggle.History
99{
1010 public class HistoryManager
1111 {
12+ string connectionString ;
13+
14+ public HistoryManager ( string connectionString )
15+ {
16+ this . connectionString = connectionString ;
17+ }
18+
1219 public void AddSessionEvent ( Guid sessionId , EventType type , Guid senderId , string senderName , IEnumerable < Guid > recipients , string data )
1320 {
14- using ( var repository = new HistoryRepository ( ) )
21+ using ( var repository = new HistoryRepository ( connectionString ) )
1522 {
1623 repository . AddSessionEvent ( sessionId , DateTime . UtcNow , type , senderId , senderName , recipients , data ) ;
1724 if ( type == EventType . Joined )
@@ -29,50 +36,50 @@ public void AddSessionEvent(Guid sessionId, EventType type, Guid senderId, strin
2936
3037 public void AddStatusUpdate ( Guid contactId , string contactName , int status )
3138 {
32- using ( var repository = new HistoryRepository ( ) )
39+ using ( var repository = new HistoryRepository ( connectionString ) )
3340 repository . AddStatusUpdate ( DateTime . UtcNow , contactId , contactName , status ) ;
3441 }
3542
3643 public IEnumerable < Session > GetSessions ( SessionCriteria criteria )
3744 {
38- using ( var repository = new HistoryRepository ( ) )
45+ using ( var repository = new HistoryRepository ( connectionString ) )
3946 return repository . GetSessions ( criteria ) ;
4047 }
4148
4249 public Session GetSession ( Guid sessionId )
4350 {
44- using ( var repository = new HistoryRepository ( ) )
51+ using ( var repository = new HistoryRepository ( connectionString ) )
4552 return repository . GetSession ( sessionId ) ;
4653 }
4754
4855
4956 public IEnumerable < StatusUpdate > GetStatusUpdates ( StatusCriteria criteria )
5057 {
51- using ( var repository = new HistoryRepository ( ) )
58+ using ( var repository = new HistoryRepository ( connectionString ) )
5259 return repository . GetStatusUpdates ( criteria ) ;
5360 }
5461
5562 public void ClearChatHistory ( )
5663 {
57- using ( var repository = new HistoryRepository ( ) )
64+ using ( var repository = new HistoryRepository ( connectionString ) )
5865 repository . ClearChatHistory ( ) ;
5966 }
6067
6168 public void ClearStatusHistory ( )
6269 {
63- using ( var repository = new HistoryRepository ( ) )
70+ using ( var repository = new HistoryRepository ( connectionString ) )
6471 repository . ClearStatusHistory ( ) ;
6572 }
6673
6774 public void AddSession ( Session newSession , IEnumerable < Participant > participants )
6875 {
69- using ( var repository = new HistoryRepository ( ) )
76+ using ( var repository = new HistoryRepository ( connectionString ) )
7077 repository . AddSession ( newSession , participants ) ;
7178 }
7279
7380 public void DeleteSessions ( IEnumerable < Guid > sessionIds )
7481 {
75- using ( var repository = new HistoryRepository ( ) )
82+ using ( var repository = new HistoryRepository ( connectionString ) )
7683 repository . DeleteSessions ( sessionIds ) ;
7784 }
7885 }
0 commit comments