Entity Framework 4.1 Code First 关系中的更改通常不需要

发布于 2024-12-04 15:07:55 字数 315 浏览 0 评论 0原文

在更改关系后运行测试用例时,我经常遇到错误。在检查数据图上的关系时,我注意到它们通常没有反映我所做的任何更改或仅反映其中的一些更改,从而使模型变得混乱。似乎只有在 Visual Studio 的服务器资源管理器中创建图表时才会出现这种情况。在 SQL Server 中创建图表时,更改显示得很好。

不幸的是,这也会影响测试代码,因为我不确定是否由于我所做的关系更改或 Visual Studio 未更新而出现问题而失败。每次都必须分离和附加数据库有点痛苦。

数据库已正确删除并重新创建,但 Visual Studio 似乎针对缓存版本运行代码。还有其他人遇到类似问题吗,有解决办法吗?

I often get errors when running test cases after changing relationships. When checking the relationships on the data diagram I notice that they are often not reflecting any of the changes I did or only some of them, confusing the model. This only seems to be the case when creating the diagram within Server Explorer of Visual Studio. When creating the diagram in SQL Server the changes show up fine.

Unfortunately, this also affects testing the code, because I'm never sure if a fails because of a problem with a change in the relationships I did or Visual Studio not updating. Having to detach and attach the database each time is a bit of a pain.

The database is dropped and recreated correctly, but Visual Studio seems to run the code against a cached version. Had anybody else similar problems, any fix?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

绻影浮沉 2024-12-11 15:07:55

我当然见过这样的问题:我更新了 SP/函数导入并尝试更新关联的复杂类型,对话框窗口在更改的列旁边显示“更新”、“删除”等,因此肯定会看到不同的情况,但是应用更新时,这些似乎通常不需要,我最终手动调整复杂类型。

在上面的示例中,我不确定正确的方法是否是删除并重新创建类型,但更新函数的存在似乎表明更新应该是可能的。正如你所说,我的也感觉像是一个缓存问题,虽然我还没有找到解决方案,但我有兴趣看看你是否能找到解决方案,如果我对此有任何根据,我也会在这里发帖!

I've certainly seen issues where I've updated SPs/function imports and tried to update the associated complex type, the dialog window says 'update', 'delete' etc next to the columns changed, so it's certainly seeing the different, but when applying the update these often don't seem to take and I end up manually adjusting the complex type.

In the above example I'm not sure whether the correct approach is to delete and recreate the type, but the existence of the update functions seem to suggest that an update should be possible. As you say mine too feels like a caching issue and whilst I've not yet found a solution I will be interested to see if you can find a solution, if I make any ground on this I will post back here too!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文