-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathPathItemRepository.cs
More file actions
34 lines (27 loc) · 1.24 KB
/
Copy pathPathItemRepository.cs
File metadata and controls
34 lines (27 loc) · 1.24 KB
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
using ByteSync.Business.PathItems;
using ByteSync.Interfaces.Controls.Applications;
using ByteSync.Interfaces.Repositories;
using DynamicData;
namespace ByteSync.Repositories;
public class PathItemRepository : BaseSourceCacheRepository<PathItem, string>, IPathItemRepository
{
private readonly ISessionInvalidationCachePolicy<PathItem, string> _sessionInvalidationCachePolicy;
public PathItemRepository(IEnvironmentService environmentService, ISessionInvalidationCachePolicy<PathItem, string> sessionInvalidationCachePolicy)
{
CurrentMemberPathItems = SourceCache
.Connect()
.Filter(pathItem => Equals(pathItem.ClientInstanceId, environmentService.ClientInstanceId!))
.AsObservableCache();
_sessionInvalidationCachePolicy = sessionInvalidationCachePolicy;
_sessionInvalidationCachePolicy.Initialize(SourceCache, true, false);
}
protected override string KeySelector(PathItem pathItem) => pathItem.Key;
public IObservableCache<PathItem, string> CurrentMemberPathItems { get; }
public IList<PathItem> SortedCurrentMemberPathItems
{
get
{
return CurrentMemberPathItems.Items.OrderBy(pi => pi.Code).ToList();
}
}
}