public bool DiffersFrom(Column other) { if(Type != other.Type) return true; if(IsKey != other.IsKey) return true; if(IsNullable != other.IsNullable) return true; if(ReferencedTable == null) return other.ReferencedTable != null; return ReferencedTable.DiffersFrom(other.ReferencedTable); }
bool IsLast(Column column) { return Columns.Last() == column; }
public string UpdateDefinition(Column modell, Column dataBase) { if(modell != null && dataBase != null) { Tracer.Assert(modell.Name == dataBase.Name); if(modell.Type != dataBase.Type) { NotImplementedMethod(modell, dataBase); return null; } if(modell.IsKey != dataBase.IsKey) { NotImplementedMethod(modell, dataBase); return null; } if(modell.IsNullable != dataBase.IsNullable) { NotImplementedMethod(modell, dataBase); return null; } if(modell.ReferencedTable == null) { NotImplementedMethod(modell, dataBase); return null; } if(modell.ReferencedTable.DiffersFrom(dataBase.ReferencedTable)) return string.Format("alter table {0} add foreign key ({1}) references {2}({3})" , Name , modell.Name , modell.ReferencedTable.Name , modell.ReferencedTable.KeyNames ); } NotImplementedMethod(modell, dataBase); return null; }