forked from yanw/App_win_iot_V2.0
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
2.7 KiB
101 lines
2.7 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace IOTContainer.SQLite
|
|
{
|
|
/// <summary>
|
|
/// 字段信息
|
|
/// </summary>
|
|
public class SQLiteColumn
|
|
{
|
|
#region 构造函数
|
|
public SQLiteColumn()
|
|
{
|
|
this.ColumnName = string.Empty;
|
|
this.PrimaryKey = false;
|
|
this.ColumnType = SQLiteColumnType.Text;
|
|
this.AutoIncrement = false;
|
|
this.NotNull = false;
|
|
this.DefaultValue = string.Empty;
|
|
}
|
|
|
|
public SQLiteColumn(string colName) : this()
|
|
{
|
|
this.ColumnName = colName;
|
|
}
|
|
|
|
public SQLiteColumn(string colName, SQLiteColumnType colDataType) : this(colName)
|
|
{
|
|
this.ColumnType = colDataType;
|
|
}
|
|
|
|
public SQLiteColumn(string colName, bool autoIncrement) : this(colName)
|
|
{
|
|
if (autoIncrement)
|
|
{
|
|
this.PrimaryKey = true;
|
|
this.ColumnType = SQLiteColumnType.Integer;
|
|
this.AutoIncrement = true;
|
|
}
|
|
else
|
|
{
|
|
this.PrimaryKey = false;
|
|
this.ColumnType = SQLiteColumnType.Text;
|
|
this.AutoIncrement = false;
|
|
}
|
|
}
|
|
|
|
public SQLiteColumn(string colName, SQLiteColumnType colDataType, bool primaryKey,
|
|
bool autoIncrement, bool notNull, string defaultValue) : this(colName)
|
|
{
|
|
if (autoIncrement)
|
|
{
|
|
this.PrimaryKey = true;
|
|
this.ColumnType = SQLiteColumnType.Integer;
|
|
this.AutoIncrement = true;
|
|
}
|
|
else
|
|
{
|
|
this.PrimaryKey = primaryKey;
|
|
this.ColumnType = colDataType;
|
|
this.AutoIncrement = false;
|
|
this.NotNull = notNull;
|
|
this.DefaultValue = defaultValue;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 字段属性
|
|
/// <summary>
|
|
/// 字段名
|
|
/// </summary>
|
|
public string ColumnName { get; set; }
|
|
|
|
/// <summary>
|
|
/// 是否有主键
|
|
/// </summary>
|
|
public bool PrimaryKey { get; set; }
|
|
|
|
/// <summary>
|
|
/// 类型
|
|
/// </summary>
|
|
public SQLiteColumnType ColumnType { get; set; }
|
|
|
|
/// <summary>
|
|
/// 自增
|
|
/// </summary>
|
|
public bool AutoIncrement { get; set; }
|
|
|
|
/// <summary>
|
|
/// 不为空
|
|
/// </summary>
|
|
public bool NotNull { get; set; }
|
|
|
|
/// <summary>
|
|
/// 默认值
|
|
/// </summary>
|
|
public string DefaultValue { get; set; }
|
|
#endregion
|
|
}
|
|
}
|
|
|