-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBaseStore.cs
More file actions
56 lines (47 loc) · 2.34 KB
/
Copy pathBaseStore.cs
File metadata and controls
56 lines (47 loc) · 2.34 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using p42BaseLib;
using p42BaseLib.Interfaces;
namespace p42ObjectStores;
public class BaseStore : IP42ObjectModelStore
{
readonly IP42Logger _logger = new P42Logger();
public virtual int NumberOfObject(string? prefix = null)
{
_logger.Debug($"NumberOfObject from prefix [{prefix}] not implemented in base class");
throw new NotImplementedException("CRUD not implemented in base class");
}
public virtual Task<T?> Get<T>(string name, string? prefix = null) where T : class
{
_logger.Debug($"Get from name [{name}] prefix [{prefix}] not implemented in base class");
throw new NotImplementedException("CRUD not implemented in base class");
}
public virtual Task<List<T>> GetAll<T>(string name = "", string? prefix = null)
{
_logger.Debug($"GetAll from name [{name}] prefix [{prefix}] not implemented in base class");
throw new NotImplementedException("CRUD not implemented in base class");
}
public virtual Task<T?> Add<T>(T model, string name, string? prefix = null) where T : class
{
_logger.Debug($"Add from model [{model}] name [{name}] prefix [{prefix}] not implemented in base class");
throw new NotImplementedException("CRUD not implemented in base class");
}
public virtual bool Delete(string name, string? prefix = null)
{
_logger.Debug($"Delete from name [{name}] prefix [{prefix}] not implemented in base class");
throw new NotImplementedException("CRUD not implemented in base class");
}
public virtual bool Update<T>(string name, T model, string? prefix = null) where T : class
{
_logger.Debug($"Update from model [{model}] name [{name}] prefix [{prefix}] not implemented in base class");
throw new NotImplementedException("CRUD not implemented in base class");
}
protected string GetPath(string name, string ext = "", string? prefix = null)
{
_logger.Debug($"GetPath from name [{name}] ext [{ext}] prefix [{prefix}]");
string path = !String.IsNullOrWhiteSpace(prefix) ? $"{prefix}" : "";
string extension = !String.IsNullOrWhiteSpace(ext) ? $".{ext}" : "";
if (!String.IsNullOrWhiteSpace(path) && !path.EndsWith("/"))
path += "/";
_logger.Debug($"GetPath returning [{path}{name}{extension}]");
return $"{path}{name}{extension}";
}
}