-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSchemeProxy.cs
60 lines (54 loc) · 1.46 KB
/
SchemeProxy.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
56
57
58
59
60
namespace DBreeze.AspNet;
internal class SchemeProxy : IScheme
{
private readonly DBreezeEngineProxy _engine;
private readonly Scheme _scheme;
private bool _disposed = false;
public SchemeProxy(DBreezeEngineProxy engine, Scheme scheme)
{
_engine = engine;
_scheme = scheme;
}
~SchemeProxy()
{
if (!_disposed)
{
_engine.Dispose(this);
}
}
public void Dispose()
{
if (_disposed) return;
_disposed = true;
_engine.Dispose(this);
}
private void ThrowIfDisposed()
{
if (_disposed) throw new ObjectDisposedException("This Proxy is disposed");
}
public string GetTablePathFromTableName(string userTableName)
{
ThrowIfDisposed();
return _scheme.GetTablePathFromTableName(userTableName);
}
public bool IfUserTableExists(string userTableName)
{
ThrowIfDisposed();
return _scheme.IfUserTableExists(userTableName);
}
public List<string> GetUserTableNamesStartingWith(string mask)
{
ThrowIfDisposed();
return _scheme.GetUserTableNamesStartingWith(mask);
}
public void DeleteTable(string userTableName)
{
ThrowIfDisposed();
_scheme.DeleteTable(userTableName);
}
public void RenameTable(string oldUserTableName, string newUserTableName)
{
ThrowIfDisposed();
_scheme.RenameTable(oldUserTableName, newUserTableName);
}
}