public static string GetType(Type type)
{
if (type == typeof (string)) {
return "TEXT";
} else if (type == typeof (int) || type == typeof (long) || type == typeof (bool)
|| type == typeof (DateTime) || type == typeof (TimeSpan) || type.IsEnum) {
return "INTEGER";
} else if (type == typeof (byte[])) {
return "BLOB";
} else {
throw new Exception (String.Format (
"The type {0} cannot be bound to a database column.", type.Name));
}
}
void CheckProperty(Type type, DbColumn column) { if (!Connection.ColumnExists(TableName, column.Name)) { AddColumnToTable(SqliteUtils.BuildColumnSchema( SqliteUtils.GetType(type), column.Name, column.DefaultValue, column.Constraints)); } }