1

Is there a way how to specify a name of a foreign key constraint in Entity Framework (v6.1.3)? I mean actual name of DB constraint (like FK_Books_AuthorId), not to specify which column is the foreign key for the given navigation property.

I know you can do it for indices, like:

Property(x => x.AuthorId).HasColumnAnnotation(IndexAnnotation.AnnotationName,
                new IndexAnnotation(new IndexAttribute("IX_Books_AuthorId")));

Is anything similar possible also for foreign key constraints?

Jan Palas
  • 1,865
  • 1
  • 23
  • 35

1 Answers1

0

Based on comments and my further research, it is not currently (EF v6.1.3) possible to set custom name for database foreign key constraint.

Jan Palas
  • 1,865
  • 1
  • 23
  • 35