forked from ThatRendle/Simple.Data
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSchemaHelper.cs
More file actions
53 lines (44 loc) · 1.87 KB
/
SchemaHelper.cs
File metadata and controls
53 lines (44 loc) · 1.87 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
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
namespace Simple.Data.IntegrationTest
{
class SchemaHelper
{
public static DataSet DummySchema()
{
var dataSet = new DataSet();
dataSet.Tables.Add(CreateTables());
dataSet.Tables.Add(CreateColumns());
return dataSet;
}
private static DataTable CreateTables()
{
var tables = new DataTable("Tables");
tables.Columns.Add("table_schema", typeof(string));
tables.Columns.Add("table_name", typeof(string));
tables.Columns.Add("table_type", typeof(string));
tables.Rows.Add("dbo", "Customer", "BASE TABLE");
tables.Rows.Add("dbo", "Orders", "BASE TABLE");
return tables;
}
private static DataTable CreateColumns()
{
var columns = new DataTable("Columns");
columns.Columns.Add("table_schema", typeof(string));
columns.Columns.Add("table_name", typeof(string));
columns.Columns.Add("column_name", typeof(string));
columns.Columns.Add("is_nullable", typeof(string));
columns.Columns.Add("data_type", typeof(string));
columns.Columns.Add("character_maximum_length", typeof(int));
columns.Rows.Add("dbo", "Customer", "CustomerId", "NO", "integer", DBNull.Value);
columns.Rows.Add("dbo", "Customer", "Name", "NO", "varchar", 100);
columns.Rows.Add("dbo", "Orders", "OrderId", "NO", "integer", DBNull.Value);
columns.Rows.Add("dbo", "Orders", "CustomerId", "NO", "integer", DBNull.Value);
columns.Rows.Add("dbo", "Orders", "Date", "NO", "datetime", DBNull.Value);
return columns;
}
}
}