Дважды создается поле первичного ключа Code-First ASP.NET

Все привет друзья.

Создаю таблицы по принципу code-first У пользователя может быть сколько угодно автомобилей. Класс описывающие поля

using System;
using System.ComponentModel.DataAnnotations;
using System.Collections.Generic;

namespace BaseModels
{
    public class BaseModelInfo
    {
       [Key]
        public int Id { get; set; }
        
        [Required]
        [MaxLength(100)]
        public string Name { get; set; }

    }


    public class User : BaseModelInfo
    {   
        public virtual Car Cars { get; set; }

    }

    public class Car : BaseModelInfo
    {
        public int User_id { get; set; }
       

    }
}

Миграция

        namespace WebApplication6.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class CreateCar_User : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Users",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Name = c.String(nullable: false, maxLength: 100),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.Cars",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        //User_id = c.Int(nullable: false),
                        Name = c.String(nullable: false, maxLength: 100),
                        User_Id = c.Int(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Users", t => t.User_Id)
                .Index(t => t.User_Id);
            
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.Cars", "User_Id", "dbo.Users");
            DropIndex("dbo.Cars", new[] { "User_Id" });
            DropTable("dbo.Cars");
            DropTable("dbo.Users");
        }
    }
}

Подключение

 namespace WebApplication6.DataModel
{
    public class DataAcces : DbContext
    {

        public DataAcces() : base("DefaultConnection")
        {
        }
        public IDbSet<User> Users { get; set; }
        public IDbSet<Car> Cars { get; set; }
    }
}

Делаю Update -Database Ошибка

**Column names in each table must be unique. Column name 'User_Id' in table 'Cars' is specified more than once.**

Ответы (0 шт):