【问题标题】:ObjectContext .CreateDatabaseScript() Ignores some entities although they are mapped correctlyObjectContext .CreateDatabaseScript() 忽略一些实体,尽管它们映射正确
【发布时间】:2011-11-18 06:23:05
【问题描述】:

ObjectContextCreateDatabaseScript() 方法,生成包含脚本的字符串以创建所需的数据库,但它忽略了一些具有相关 FK 的实体

当我查看脚本时,我发现了类似的东西

-- Ignoring entity set with defining query: [FMISDomainModelEFStoreContainer].[Ex_Students]

-- Ignoring association set with participating entity set with defining query: [FK_Ex_Students_City]

我的模型有问题吗?虽然验证正确。

【问题讨论】:

    标签: entity-framework-4 objectcontext


    【解决方案1】:

    哦,抱歉我找到了,在实体模型的 XML 中出现这个错误

    Errors Found During Generation:
          warning 6002: The table/view 'FMIS.dbo.MyTableName' does not have a primary key defined. The key has been inferred and the definition was created as a read-only table/view.
    

    我认为这就是为什么它没有在我的模型的 StorageModel 中生成的原因

    【讨论】:

    • :) 但是如何解决呢?这很奇怪,在 ConceptualModel 中有这些表的 PK,在 StorageModel 中也有。
    猜你喜欢
    • 2018-02-09
    • 2011-03-05
    • 1970-01-01
    • 2021-11-22
    • 2020-03-21
    • 1970-01-01
    • 2022-09-24
    • 1970-01-01
    • 2012-05-18
    相关资源
    最近更新 更多