联合密钥缺少MVC

时间:2014-03-13 12:14:56

标签: c# sql-server asp.net-mvc entity-framework asp.net-mvc-5

真的需要一些帮助...... 我正在尝试让我的MVC应用程序使用Syndication库作为我的程序的RSS提要阅读器部分,并在尝试启用迁移时遇到困难:

RssProject.Models.SyndicationPerson: : EntityType 'SyndicationPerson' has no key     defined. Define the key for this EntityType.
RssProject.Models.SyndicationElementExtension: : EntityType 'SyndicationElementExtension' has no key defined. Define the key for this EntityType.
RssProject.Models.SyndicationCategory: : EntityType 'SyndicationCategory' has no key defined. Define the key for this EntityType.
RssProject.Models.SyndicationLink: : EntityType 'SyndicationLink' has no key defined. Define the key for this EntityType.
SyndicationContents: : The referenced EntitySet 'SyndicationContents' for End 'SyndicationItem_Copyright_Target' could not be found in the containing EntityContainer.
SyndicationContents: : The referenced EntitySet 'SyndicationContents' for End 'SyndicationFeed_Copyright_Target' could not be found in the containing EntityContainer.
SyndicationContents: : The referenced EntitySet 'SyndicationContents' for End 'SyndicationFeed_Description_Target' could not be found in the containing EntityContainer.
SyndicationContents: : The referenced EntitySet 'SyndicationContents' for End   'SyndicationFeed_Title_Target' could not be found in the containing EntityContainer.
SyndicationContents: : The referenced EntitySet 'SyndicationContents' for End 'SyndicationItem_Summary_Target' could not be found in the containing EntityContainer.
SyndicationContents: : The referenced EntitySet 'SyndicationContents' for End 'SyndicationItem_Title_Target' could not be found in the containing EntityContainer.
SyndicationPersons: EntityType: EntitySet 'SyndicationPersons' is based on type 'SyndicationPerson' that has no keys defined.
SyndicationElementExtensions: EntityType: EntitySet 'SyndicationElementExtensions' is based on type 'SyndicationElementExtension' that has no keys defined.
SyndicationCategories: EntityType: EntitySet 'SyndicationCategories' is based on type 'SyndicationCategory' that has no keys defined.
SyndicationLinks: EntityType: EntitySet 'SyndicationLinks' is based on type 'SyndicationLink' that has no keys defined.
SyndicationContents: EntityType: EntitySet 'SyndicationContents' is based on type 'SyndicationContent' that has no keys defined.

(我必须在联合之前添加,我使用Web客户端使用简单的feed阅读功能,但它不支持某些xml类型,所以我决定切换到联合。)

我正在集思广益,并在最近几个小时内搜索网络以找到一些帮助但没有成功。在尝试' update-database -force 之后,已经删除旧数据库并创建了新数据库strong>'结果相同。

认为它可能与实体框架有关,但它已更新到最新版本。

这是我的班级:

public class Feeds
{
    [Key]
    public int FeedId { get; set; }
    public SyndicationItem Feed { get; set; }

    public int SiteId { get; set; }
}

编辑:指出我显然使用代码优先迁移

任何帮助都将不胜感激!

0 个答案:

没有答案