Код: Выделить всё
internal class RelationTypeModel
{
public Guid Id { get; init; }
public required string Name { get; init; }
public class Configurator : IEntityTypeConfiguration
{
public void Configure(EntityTypeBuilder builder)
{
builder.ToTable("graph_relation_types");
builder.Property(r => r.Id)
.HasColumnName("relation_type_id")
.HasValueGenerator();
}
}
}
< /code>
internal class GraphRelationModel
{
public Guid Id { get; init; }
public Guid RelationTypeId { get; init; }
public virtual RelationTypeModel? RelationType { get; init; }
public class Configurator : IEntityTypeConfiguration
{
public void Configure(EntityTypeBuilder builder)
{
builder
.ToTable("graph_relations");
builder.Property(r => r.Id)
.HasColumnName("graph_relation_id")
.HasValueGenerator();
builder.Property(r => r.RelationTypeId)
.HasColumnName("relation_type_id");
}
}
}
это до правильного значения. Теперь это изменяет это на недействительный. Я считаю это недействительным, потому что используется имя типа, а не имя таблицы. Почему EF делает это? Я вынужден добавить имя вручную, чтобы предотвратить такие изменения в будущем.
Подробнее здесь: https://stackoverflow.com/questions/796 ... creating-n
Мобильная версия