えっ、CountryをCountriesにしてくれるCode First Migration

モデルを作ってadd-migrationしたんです。

モデルは次のようなものです

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

namespace Megsuritan.Models
{
    public class Country
    {
        public int ID { get; set; }

        [Display(Name = "国名")]
        [MaxLength(100)]
        [Required]
        public string CountryName { get; set; }

        [Display(Name = "首都")]
        [MaxLength(100)]
        public string Capital { get; set; }
    }
}

で、パッケージマネージャーコンソールからadd-migrationしてできたソースが、これ。(抜粋です)

namespace Megsuritan.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class first : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Countries",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        CountryName = c.String(nullable: false, maxLength: 100),
                        Capital = c.String(maxLength: 100),
                    })
                .PrimaryKey(t => t.ID);
        }
        
        public override void Down()
        {
            DropTable("dbo.Users");
        }
    }
}

赤字の部分"dbo.Countries"となっていますね( ^ω^)・・・

update-databaseして出来上がったテーブルはコード通りCountriesでした。orz

なんか、頭いいんだろうけど、おせっかいだとも思うのですよ。