CreateDatabaseScript()
的 ObjectContext
方法,生成包含脚本的字符串以创建所需的数据库,但它忽略了一些具有相关FK的实体
当我查看脚本时,我发现了类似的内容
-- Ignoring entity set with defining query: [FMISDomainModelEFStoreContainer].[Ex_Students]
-- Ignoring association set with participating entity set with defining query: [FK_Ex_Students_City]
我的模特有问题吗?虽然它已经过正确验证。
答案 0 :(得分:0)
哦,抱歉,我发现它,在实体模型的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中生成的