-
Notifications
You must be signed in to change notification settings - Fork 16
/
BoardDataRepository.cs
55 lines (40 loc) · 1.38 KB
/
BoardDataRepository.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
55
using AutomaticTypeMapper;
using Optional;
using System.Collections.Generic;
namespace EOLib.Domain.Interact.Board
{
public interface IBoardRepository
{
Option<int> BoardId { get; set; }
HashSet<BoardPostInfo> Posts { get; set; }
Option<BoardPostInfo> ActivePost { get; set; }
Option<string> ActivePostMessage { get; set; }
}
public interface IBoardProvider
{
Option<int> BoardId { get; }
IReadOnlyCollection<BoardPostInfo> Posts { get; }
Option<BoardPostInfo> ActivePost { get; }
Option<string> ActivePostMessage { get; }
}
[AutoMappedType(IsSingleton = true)]
public class BoardDataRepository : IBoardRepository, IBoardProvider, IResettable
{
public Option<int> BoardId { get; set; }
public HashSet<BoardPostInfo> Posts { get; set; }
IReadOnlyCollection<BoardPostInfo> IBoardProvider.Posts => Posts;
public Option<BoardPostInfo> ActivePost { get; set; }
public Option<string> ActivePostMessage { get; set; }
public BoardDataRepository()
{
ResetState();
}
public void ResetState()
{
BoardId = Option.None<int>();
Posts = new HashSet<BoardPostInfo>();
ActivePost = Option.None<BoardPostInfo>();
ActivePostMessage = Option.None<string>();
}
}
}