Навигационные свойства при миграции
Всем привет. Добавляю с БД табличку. В Entity модели у нее есть ряд навигационных свойств. Вопрос. Как сделать так, чтобы при миграции в БД не создавались столбцы по этим навигационным свойствам?
Пример модели:
public class TransferFormEntity : GuidBasedEntity
{
public Guid CallTransferId { get; set; }
public string TranserFormIdentifier { get; set; }
public string? OperatorSignature { get; set; }
public string? Stamp { get; set; }
public byte IsOutbound { get; set; }
#region Navigation
public virtual UserCallEventEntity? UserCallEvent { get; set; }
public virtual CallerEntity? Caller { get; set; }
public virtual GlobalDataEntity? Global { get; set; }
public virtual UserEntity? User { get; set; }
public virtual CallerRequestEntity? CallerRequest { get; set; }
public virtual CallTransferDataEntity? CallTransfer { get; set; }
#endregion
}
Миграция создает вот такую таблицу:
migrationBuilder.CreateTable(
name: "TransferForm",
schema: "dbo",
columns: table => new
{
ID = table.Column<Guid>(type: "uuid", nullable: false),
CallTransferId = table.Column<Guid>(type: "uuid", nullable: false),
TranserFormIdentifier = table.Column<string>(type: "text", nullable: false),
OperatorSignature = table.Column<string>(type: "text", nullable: true),
Stamp = table.Column<string>(type: "text", nullable: true),
IsOutbound = table.Column<byte>(type: "smallint", maxLength: 4, nullable: false),
UserCallEventId = table.Column<int>(type: "integer", nullable: true),
CallerId = table.Column<Guid>(type: "uuid", nullable: true),
GlobalId = table.Column<int>(type: "integer", nullable: true),
UserId = table.Column<Guid>(type: "uuid", nullable: true),
CallerRequestCallerId = table.Column<Guid>(type: "uuid", nullable: true),
CallerRequestUserCallEventId = table.Column<int>(type: "integer", nullable: true)
},
Пока на ум пришло только попробовать удалить из миграции сгерерированные в коде выше не нужные столбцы и обновить БД. Но правильно ли это ?
Источник: Stack Overflow на русском