記事用に次のモデルがあります。
public class Article
{
[Key]
public int ArticleId { get; set; }
[Required(ErrorMessage = "Title is required."), MaxLength(80)]
public string Title { get; set; }
[Required(ErrorMessage = "Body is required.")]
public string Body { get; set; }
public DateTime Time { get; set; }
public int AuthorId { get; set; }
// Navigation properties
public virtual UserProfile Author { get; set; }
public virtual ICollection<Tag> Tags { get; set; }
public virtual ICollection<Comment> Comments { get; set; }
}
これUserProfile
は、MVC4 標準プロジェクトのデフォルトの拡張バージョンです。
今、私のスキャフォールディングされたコントローラー/ビューでは、Author
.
私のデータベース (MySQL) には、namedAuthor_UserId
の typeのフィールドが含まれていますint
。
なにが問題ですか?
また、ナビゲーション プロパティとAuthorId