-
Notifications
You must be signed in to change notification settings - Fork 1
/
Column.cs
72 lines (58 loc) · 1.85 KB
/
Column.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
61
62
63
64
65
66
67
68
69
70
71
72
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC
{
public class Column : IVisitable
{
public void setColumnDataType(string dt)
{
switch(dt)
{
case "varchar":
DataType = ColumnDataType.varchar;
break;
case "int":
DataType = ColumnDataType.numInt;
break;
case "float":
DataType = ColumnDataType.numFloat;
break;
case "tinyint":
DataType = ColumnDataType.tinyInt;
break;
default:
DataType = ColumnDataType.nill;
break;
}
}
public Column(string _name, string _dataType)
{
Name = _name;
setColumnDataType(_dataType);
Header = _name;
}
public string Name { get; set; }
public ColumnDataType DataType { get; set; }
public string Header { get; set; }
public bool ReadOnly { get; set; } = false;
public bool Hide { get; set; } = false;
public bool IsPrimaryKey { get; set; } = false;
public bool IsForeignKey { get; set; } = false;
public bool IsForeignKeyMapped { get; set; } = false;
public ForeignKey ForeignKeyMap { get; set; }
public Dictionary<string, string> Options { get; set; } = new Dictionary<string, string>();
public bool IsDropdown => Options.Count > 0;
public void Accept(IVisitor visitor)
{
visitor.Visit(this);
}
}
public struct ForeignKey
{
public Table ToTable { get; set; }
public string Column { get; set; }
}
}