Entity Framework Code First Migrations: Set Primary Key Value

后端 未结 3 2147
感情败类
感情败类 2020-12-05 23:59

I have a table that stores some extra data for some rows of a table like:

public class QuoteExtra
{
    [Key]
    public int QuoteId { get; set; }
    // Mor         


        
3条回答
  •  Happy的楠姐
    2020-12-06 00:45

    I could'nt solve this Problem with your Hints then i've tried to re-create the whole Database but it wasnt working, too.

    To fix this you have to remove the identity: true property on the first(!) creation of the Column (e.g. Initial-Migration).

    Maybe it will help someone..

提交回复
热议问题