Source structure
Energy.Source.Structure provides database schema objects: columns, indexes, rows, and tables.
Column
Energy.Source.Structure.Column represents a table column.
Energy.Source.Structure.Column column = new Energy.Source.Structure.Column("Id", "INTEGER", "Identifier");
column.Primary = true;
column.NotNull = true;
column.Increment = 1;
Properties
| Property | Description |
|---|---|
Name |
Column name. |
Type |
Column type. |
Specific |
Database-specific type modifiers. |
Label |
Display label. |
Description |
Description. |
Format |
Display format. |
Length |
Maximum length. |
Order |
Order index. |
Minimum / Maximum |
Value range. |
Primary |
Primary key. |
Index |
Indexed. |
Unique |
Unique. |
NotNull |
Not null. |
Unsigned |
Unsigned. |
Increment |
Auto-increment. |
Ignore |
Ignore when generating scripts. |
Column.Array
Energy.Source.Structure.Column.Array columns = new Energy.Source.Structure.Column.Array();
Energy.Source.Structure.Column id = columns.New("Id");
id.Type = "INTEGER";
Energy.Source.Structure.Column primary = columns.GetPrimary();
Index
Energy.Source.Structure.Index represents an index with columns and includes.
Row
Energy.Source.Structure.Row is a serializable dictionary of column values.
Energy.Source.Structure.Row row = new Energy.Source.Structure.Row();
row["Id"] = 1;
row["Name"] = "Alice";
Table
Energy.Source.Structure.Table represents a database table.
Energy.Source.Structure.Table table = new Energy.Source.Structure.Table();
table.Name = "Users";
table.Identity = "Id";
table.Engine = "InnoDB";
Energy.Source.Structure.Column id = table.Columns.New("Id");
id.Type = "INTEGER";
id.Primary = true;
id.Increment = 1;
Energy.Source.Structure.Column name = table.Columns.New("Name");
name.Type = "VARCHAR(100)";
name.NotNull = true;
Table properties
| Property | Description |
|---|---|
Name |
Table name. |
Schema |
Schema name. |
Identity |
Identity column name. |
Description |
Table description. |
Engine |
Storage engine (MySQL). |
Columns |
Column array. |
Indexes |
Index array. |
Rows |
Row array. |