では、具体的な手順を追っていきたい。 ■エンティティに検証ルールを追加する 検証ルールは、前回作成したエンティティのプロパティに属性(アノテーション)として付与するのが基本だ。具体的なコードは、以下のとおり(追加のコードは太字で表している)。 using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel; namespace MvcApp.Models { public class Book { [Key] [DisplayName("ISBNコード")] [Required(ErrorMessage = "{0}は必須です。")] [RegularExpression("[0-9]{3}-[0-9]{1}-[0