문제

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?

도움이 되었습니까?

해결책

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

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top