文章内容

2017/1/22 14:53:29,作 者: 黄兵

已添加了具有相同键的项

今天在写代码的时候,遇到了如下错误:

已添加了具有相同键的项。

后来在网上寻找答案,终于找到了答案。

是因为Model中有重复定义的项。

后来我检查model,果然是model第一重复,截图如下:


之后修改,删除重复的Keyword就可以了。

 public class BlogAddArtViewModel
    {
        [DisplayName("作者")]
        public int AuthorId{get;set;}
        [DisplayName("标题")]
        public string Title { get; set; }
        [DisplayName("文章类别")]
        public virtual Category Category { get; set; }
        [DisplayName("专题页面")]
        public bool Topics { get; set; }
        [DisplayName("正文")]
        public string Body { get; set; }
        [DisplayName("关键字")]
        public string Keyword { get; set; }
        [DisplayName("描述")]
        public string Description { get; set; }
        public int CategoryId { get; set; }
        public DateTime CreationTime { get; set; }
        public DateTime UpdateTime { get; set; }
        public int ArchivesId { get; set; }
    }

参考资料:布布扣

分享到:

发表评论

评论列表