Change foreign key constraint naming convention

c# code-first entity-framework naming-conventions

Question

I need to adjust the name convention for the automatically produced foreign key restrictions because we have our own external convention for naming objects. Now, it appears that:FK_dbo.City_dbo.CityType_City_CityTypeId but I'd prefer for it to be labeledCity_FKC_CityType .

I discovered a a similar query that states that you can manually change the name of constraints. Since I have numerous tables with foreign key limitations, this is not ideal for me.

I've read about "Custom Code First Conventions" and am curious whether I can use them to change the name of a constraint or if there are other ways to go about doing so.

Another option is to get the EF source code, modify it, and then use it, although this should only be done in an emergency.

As a side note, I'd also like to alter the primary key's naming structure.

1
12
5/23/2017 11:46:54 AM

Accepted Answer

ZZZ_tmp
11
7/23/2015 4:57:38 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow