/// <summary> /// /// </summary> /// <param name="foreignKey"></param> /// <param name="table"></param> /// <returns></returns> private ForeignKeyInfo GetForeignKey(IForeignKey foreignKey, EFTableInfo table) { var result = new ForeignKeyInfo(); result.Table = table; result.Name = foreignKey.Relational().Name; result.Column = table.GetColumn(foreignKey.GetColumnName()); result.ReferenceTable = GetReferenceTable(foreignKey); result.ReferenceColumn = result.ReferenceTable.GetColumn(foreignKey.GetReferenceColumnName()); _migrateManager.CorrectName(result); return(result); }
/// <summary> /// /// </summary> /// <param name="table"></param> /// <returns></returns> private PrimaryKeyInfo GetPrimaryKeyInfo(EFTableInfo table) { var primary = table.Entity.FindPrimaryKey(); var primaryRelational = primary?.Relational(); if (primaryRelational == null) { return(null); } var result = new PrimaryKeyInfo(); result.Name = primaryRelational.Name; result.Table = table; var prop = primary.Properties?.FirstOrDefault(); var name = prop?.Relational()?.ColumnName; result.PrimaryColumn = table.GetColumn(name); _migrateManager.CorrectName(result); return(result); }
/// <summary> /// /// </summary> /// <param name="table"></param> /// <param name="property"></param> /// <returns></returns> private ColumnInfo GetUniqueColumn(EFTableInfo table, IProperty property) { return(table.GetColumn(property.Relational().ColumnName)); }