实体框架代码优先 - 不支持索引属性

发布于 2024-12-12 13:58:19 字数 125 浏览 4 评论 0原文

在带有实体框架代码的 poco 上使用索引器首先会抛出错误“不支持索引属性”。保存上下文时。

有没有办法首先在 pocos 上使用实体框架代码的索引器?我尝试将 [NotMapped] 属性应用于索引器声明,但没有帮助。

Using indexers on a poco with entity framework code first throws the error "Indexed properties are not supported." when saving the context.

Is there a way to use indexers on pocos with entity framework code first? I tried applying the [NotMapped] attribute to the indexer declaration but it did not help.

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

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

发布评论

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

评论(1

不知在何时 2024-12-19 13:58:20

尝试使用 WriteEDMX 来查看 EDMX 是否引用了这些属性 - 我怀疑不是,并且限制在于核心 EF 运行时而不是 Code First(Code First 在您创建第一个 DbContext 时已完成)。

Try using WriteEDMX to see whether the EDMX is referencing those properties - I suspect it isn't and that the limitation is with the core EF runtime not Code First (Code First is finished by the time you create your first DbContext).

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