void CheckProperty(Type type, DbColumn column) { if (!Connection.ColumnExists(TableName, column.Name)) { AddColumnToTable(SqliteUtils.BuildColumnSchema( SqliteUtils.GetType(type), column.Name, column.DefaultValue, column.Constraints)); } }
private AbstractDatabaseColumn(AbstractDatabaseColumnAttribute attribute, MemberInfo member_info, Type type) { try { column_type = SqliteUtils.GetType(type); } catch (Exception e) { throw new Exception(string.Format( "{0}.{1}: {2}", member_info.DeclaringType, member_info.Name, e.Message)); } this.name = attribute.ColumnName ?? member_info.Name; this.type = type; }
public void ClearProperty <U> (DbColumn column) { if (!Connection.ColumnExists(TableName, column.Name)) { AddColumnToTable(SqliteUtils.BuildColumnSchema( SqliteUtils.GetType(typeof(U)), column.Name, column.DefaultValue, column.Constraints)); } else { Connection.Execute(string.Format( "UPDATE {0} SET {1}='{2}'", TableName, column.Name, column.DefaultValue)); } }