forked from cyq1162/cyqdata
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNoSqlDal.cs
46 lines (43 loc) · 1.38 KB
/
NoSqlDal.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
using CYQ.Data.Table;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace CYQ.Data
{
internal partial class NoSqlDal : DalBase
{
public NoSqlDal(ConnObject co)
: base(co)
{
}
protected override System.Data.Common.DbProviderFactory GetFactory()
{
return new NoSqlFactory(this);
}
protected override bool IsExistsDbName(string dbName)
{
string folder = Con.DataSource.TrimEnd('\\', '/');
folder = folder.Substring(0, folder.Length - DataBaseName.Length) + dbName;
return System.IO.Directory.Exists(folder);
}
}
internal partial class NoSqlDal
{
public override Dictionary<string, string> GetTables()
{
Dictionary<string, string> tables = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
string[] files = Directory.GetFiles(Con.DataSource, "*.ts");
foreach (string file in files)
{
MDataColumn mdc = MDataColumn.CreateFrom(file);
if (mdc != null)
{
tables.Add(Path.GetFileNameWithoutExtension(file), mdc.Description);
}
}
files = null;
return tables;
}
}
}