Question

I primarily use Fluent NHibernate, where I can easily create a foreign key and/ or primary key constraint naming convention, but I'm having a deuce of a time figuring out how to do the same thing in EF6.

I want my PKs to look like pkFoo for table dbo.Foo, and my FKs to look like fkBar.BarId_Foo.BarId when linking tables dbo.Foo and dbo.Bar on the similar columns BarId, with the table that is alphanumerically first named first.

I took a look at inheriting from PrimaryKeyNameForeignKeyDiscoveryConvention, but there does not seem to be a way to actually change the constraint name.

Is this not possible in EF? Am I approaching this incorrectly?

Was it helpful?

Solution

Check this out it does not appear like it is possible but is being tracked for future releases:

http://entityframework.codeplex.com/workitem/1226

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top