I\'m using Entity Framework Codefirst to create my Database. The default Primary key with the schema name dbo.pk_Jobs seems to upset access 2007 when I connect to it over OD
(This is a complement to the answer/comments by @Jeff Sivers and @cubski.)
As far as I know you can't specify the PK name with Data Attribute. Sometimes I need to get rid of the dbo. part of the name and I then use a manually edited code first migration to change the name, like this:
public partial class ChangeNameOnPKInCustomers : DbMigration
{
private static string fromName = "PK_dbo.Customers"; // Name to change
private static string toName = fromName.Replace("dbo.", "");
public override void Up()
{
Sql($"exec sp_rename @objname=N'[dbo].[{fromName}]', @newname=N'{toName}'");
// Now the PK name is "PK_Customers".
}
public override void Down()
{
Sql($"exec sp_rename @objname=N'[dbo].[{toName}]', @newname=N'{fromName}'");
// Back to "PK_dbo.Customers".
}
}