-
Notifications
You must be signed in to change notification settings - Fork 6
Create SQL Table
Imran J edited this page Dec 22, 2018
·
2 revisions
All SQL tables are located in the database folder and separated by the group of data they represent.
To create a new table you must create a new class and tag it by TableName attribute.
All column are represented by public properties and variables, if you set a property or variable private or protected, it won't be generated by the ORM and you won't be able retrieve data from database with those ones.
You can also add others attributes like :
- PrimaryKey : To set a column as primary key in the table. (above a property/variable)
- NullString : To allow a column to be null. (above a property/variable)
- Index : To set an index on a colmun. (above a property/variable)
- TableName : To indicate that the class is a SQL Table structure. (above a class) between the parenthesis, it's the tablename of the database.
[TableName("accounts")]
public class AccountRecord : IAutoGeneratedRecord
{
[PrimaryKey("Id")]
public int Id { get; set; }
[NullString]
public string Username { get; set; }
[Index]
public byte Authority { get; set; }
public string Password { get; set; }
public string HDSN { get; set; }
public string IP_Key { get; set; }
}