Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

Edited Unassigned: BUG: TableBuilder.PrimaryKey [1597]

$
0
0
#Migrations

When specifying a custom column-name for Primary Key, it isn't used.
There are no tests covering the scenario, and so even though the API seems to support it, it isn't implemented.

Example:
```
CreateTable(
"dbo.MyTable",
c => new
{
Id = c.Long(nullable: false, identity: true, name: "intMyCustomId")
})
.PrimaryKey(t => t.Id, name: "intMyCustomId");
```

generates the following DDL:

```
CREATE TABLE [dbo].[MyTable] (
[intMyCustomId] [bigint] NOT NULL IDENTITY,
CONSTRAINT [PK_dbo.MyTable] PRIMARY KEY ([Id])
```

Which gives the following error:
> System.Data.SqlClient.SqlException (0x80131904): Column name 'Id' does not exist in the target table or view.

Viewing all articles
Browse latest Browse all 10318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>